Place an async order
curl --request POST \
--url https://api.anchorage-staging.com/v2/trading/async-order \
--header 'Api-Access-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"currency": "BTC",
"quantity": "100.00",
"symbol": "BTC-USD",
"timestamp": "2023-11-07T05:31:56Z",
"accountId": "0e2b2f9d-8d10-4f1e-960b-28567255045f",
"allocation": [
{
"quantity": "10000",
"subaccountId": "<string>",
"specLotId": "550e8400-e29b-41d4-a716-446655440000"
}
],
"limitPrice": "21005.5",
"parameters": {
"endTime": "2023-11-07T05:31:56Z",
"triggerPrice": "21005.5"
},
"specLotId": "550e8400-e29b-41d4-a716-446655440000",
"subaccountId": "343b6c83-6d91-4f13-9982-2109abd2dbb0"
}
'import requests
url = "https://api.anchorage-staging.com/v2/trading/async-order"
payload = {
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"currency": "BTC",
"quantity": "100.00",
"symbol": "BTC-USD",
"timestamp": "2023-11-07T05:31:56Z",
"accountId": "0e2b2f9d-8d10-4f1e-960b-28567255045f",
"allocation": [
{
"quantity": "10000",
"subaccountId": "<string>",
"specLotId": "550e8400-e29b-41d4-a716-446655440000"
}
],
"limitPrice": "21005.5",
"parameters": {
"endTime": "2023-11-07T05:31:56Z",
"triggerPrice": "21005.5"
},
"specLotId": "550e8400-e29b-41d4-a716-446655440000",
"subaccountId": "343b6c83-6d91-4f13-9982-2109abd2dbb0"
}
headers = {
"Api-Access-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Access-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clOrderId: '6fb5fc79-0bb4-446d-82dd-d4687fb56a02',
currency: 'BTC',
quantity: '100.00',
symbol: 'BTC-USD',
timestamp: '2023-11-07T05:31:56Z',
accountId: '0e2b2f9d-8d10-4f1e-960b-28567255045f',
allocation: [
{
quantity: '10000',
subaccountId: '<string>',
specLotId: '550e8400-e29b-41d4-a716-446655440000'
}
],
limitPrice: '21005.5',
parameters: {endTime: '2023-11-07T05:31:56Z', triggerPrice: '21005.5'},
specLotId: '550e8400-e29b-41d4-a716-446655440000',
subaccountId: '343b6c83-6d91-4f13-9982-2109abd2dbb0'
})
};
fetch('https://api.anchorage-staging.com/v2/trading/async-order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"orderId": "a94c8d75-6c9d-4903-95f3-5b0893e76cb7",
"subaccountId": "9236041d-f69d-4cb9-a747-684a288cec81",
"symbol": "BTC-USD",
"side": "BUY",
"currency": "USD",
"counterCurrency": "BTC",
"orderQty": "10000.00",
"orderType": "STOP_LIMIT",
"timeInForce": "GTC",
"orderStatus": "PENDING_NEW",
"execId": "58fd5afc-b85e-45d1-951e-d6429ea9cd54",
"execType": "PENDING_NEW",
"avgPx": "21990.01",
"avgPxAllIn": "21968.02",
"cumQty": "10000",
"counterQty": "0.45475",
"counterQtyAllIn": "0.45430",
"fillPx": "21990.01",
"fillQty": "10000",
"leavesQty": "0",
"cancelQty": "0",
"fee": "0.00045521",
"feeCurrency": "BTC",
"transactTime": "2023-03-12T22:22:09.925050Z",
"submitTime": "2023-03-12T22:22:09.909251Z"
}
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}Place an async order
Permissions required: Execute trades
Place an order, either Limit, StopLoss, StopLimit or TakeProfitLimit currently FillOrKill, ImediateOrCancel or GoodTillCancel are supported.
One of accountId or subaccountId must be specified but not both.
POST
/
trading
/
async-order
Place an async order
curl --request POST \
--url https://api.anchorage-staging.com/v2/trading/async-order \
--header 'Api-Access-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"currency": "BTC",
"quantity": "100.00",
"symbol": "BTC-USD",
"timestamp": "2023-11-07T05:31:56Z",
"accountId": "0e2b2f9d-8d10-4f1e-960b-28567255045f",
"allocation": [
{
"quantity": "10000",
"subaccountId": "<string>",
"specLotId": "550e8400-e29b-41d4-a716-446655440000"
}
],
"limitPrice": "21005.5",
"parameters": {
"endTime": "2023-11-07T05:31:56Z",
"triggerPrice": "21005.5"
},
"specLotId": "550e8400-e29b-41d4-a716-446655440000",
"subaccountId": "343b6c83-6d91-4f13-9982-2109abd2dbb0"
}
'import requests
url = "https://api.anchorage-staging.com/v2/trading/async-order"
payload = {
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"currency": "BTC",
"quantity": "100.00",
"symbol": "BTC-USD",
"timestamp": "2023-11-07T05:31:56Z",
"accountId": "0e2b2f9d-8d10-4f1e-960b-28567255045f",
"allocation": [
{
"quantity": "10000",
"subaccountId": "<string>",
"specLotId": "550e8400-e29b-41d4-a716-446655440000"
}
],
"limitPrice": "21005.5",
"parameters": {
"endTime": "2023-11-07T05:31:56Z",
"triggerPrice": "21005.5"
},
"specLotId": "550e8400-e29b-41d4-a716-446655440000",
"subaccountId": "343b6c83-6d91-4f13-9982-2109abd2dbb0"
}
headers = {
"Api-Access-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Access-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clOrderId: '6fb5fc79-0bb4-446d-82dd-d4687fb56a02',
currency: 'BTC',
quantity: '100.00',
symbol: 'BTC-USD',
timestamp: '2023-11-07T05:31:56Z',
accountId: '0e2b2f9d-8d10-4f1e-960b-28567255045f',
allocation: [
{
quantity: '10000',
subaccountId: '<string>',
specLotId: '550e8400-e29b-41d4-a716-446655440000'
}
],
limitPrice: '21005.5',
parameters: {endTime: '2023-11-07T05:31:56Z', triggerPrice: '21005.5'},
specLotId: '550e8400-e29b-41d4-a716-446655440000',
subaccountId: '343b6c83-6d91-4f13-9982-2109abd2dbb0'
})
};
fetch('https://api.anchorage-staging.com/v2/trading/async-order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"clOrderId": "6fb5fc79-0bb4-446d-82dd-d4687fb56a02",
"orderId": "a94c8d75-6c9d-4903-95f3-5b0893e76cb7",
"subaccountId": "9236041d-f69d-4cb9-a747-684a288cec81",
"symbol": "BTC-USD",
"side": "BUY",
"currency": "USD",
"counterCurrency": "BTC",
"orderQty": "10000.00",
"orderType": "STOP_LIMIT",
"timeInForce": "GTC",
"orderStatus": "PENDING_NEW",
"execId": "58fd5afc-b85e-45d1-951e-d6429ea9cd54",
"execType": "PENDING_NEW",
"avgPx": "21990.01",
"avgPxAllIn": "21968.02",
"cumQty": "10000",
"counterQty": "0.45475",
"counterQtyAllIn": "0.45430",
"fillPx": "21990.01",
"fillQty": "10000",
"leavesQty": "0",
"cancelQty": "0",
"fee": "0.00045521",
"feeCurrency": "BTC",
"transactTime": "2023-03-12T22:22:09.925050Z",
"submitTime": "2023-03-12T22:22:09.909251Z"
}
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}Body
application/json
Parameters to place an order.
Was this page helpful?