curl --request POST \
--url https://api.anchorage-staging.com/v2/trading/quote/accept \
--header 'Api-Access-Key: <api-key>' \
--header 'Api-Signature: <api-signature>' \
--header 'Api-Timestamp: <api-timestamp>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "6290d9bd-494f-11ed-975e-2e567b4c0e09",
"quoteID": "<string>",
"side": "BUY",
"allowedSlippage": "0.0005",
"idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0393",
"vaultID": "1c920f4241b78a1d483a29f3c24b6c4c"
}
'import requests
url = "https://api.anchorage-staging.com/v2/trading/quote/accept"
payload = {
"accountId": "6290d9bd-494f-11ed-975e-2e567b4c0e09",
"quoteID": "<string>",
"side": "BUY",
"allowedSlippage": "0.0005",
"idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0393",
"vaultID": "1c920f4241b78a1d483a29f3c24b6c4c"
}
headers = {
"Api-Signature": "<api-signature>",
"Api-Timestamp": "<api-timestamp>",
"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-Signature': '<api-signature>',
'Api-Timestamp': '<api-timestamp>',
'Api-Access-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountId: '6290d9bd-494f-11ed-975e-2e567b4c0e09',
quoteID: '<string>',
side: 'BUY',
allowedSlippage: '0.0005',
idempotentId: '01944c42-5ad3-4108-b376-f78cd6ff0393',
vaultID: '1c920f4241b78a1d483a29f3c24b6c4c'
})
};
fetch('https://api.anchorage-staging.com/v2/trading/quote/accept', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"quoteID": "06f71d1e-e7e8-11ea-adc1-0242ac120002",
"side": "BUY",
"tradeStatus": "EXECUTED",
"tradeID": "d1ae1416-ebd7-11ea-adc1-0242ac120002"
}
}{
"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": "Conflict",
"message": "tradeID=07ceab88-944f-4ea7-9ebf-9d1f5672b59a,tradeStatus=EXECUTED"
}{
"errorType": "UnprocessableEntity",
"message": "The amount requested exceeds credit limit"
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}Accept a quote
Permissions required: Execute trades
Accept a quote by its quoteID and side.
Idempotent Requests
This endpoint supports idempotent requests so that a quote cannot be accepted twice if an API call was interrupted and is retried. To send an idempotent request, include the idempotentId field in the body of the POST request.
curl --request POST \
--url https://api.anchorage-staging.com/v2/trading/quote/accept \
--header 'Api-Access-Key: <api-key>' \
--header 'Api-Signature: <api-signature>' \
--header 'Api-Timestamp: <api-timestamp>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "6290d9bd-494f-11ed-975e-2e567b4c0e09",
"quoteID": "<string>",
"side": "BUY",
"allowedSlippage": "0.0005",
"idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0393",
"vaultID": "1c920f4241b78a1d483a29f3c24b6c4c"
}
'import requests
url = "https://api.anchorage-staging.com/v2/trading/quote/accept"
payload = {
"accountId": "6290d9bd-494f-11ed-975e-2e567b4c0e09",
"quoteID": "<string>",
"side": "BUY",
"allowedSlippage": "0.0005",
"idempotentId": "01944c42-5ad3-4108-b376-f78cd6ff0393",
"vaultID": "1c920f4241b78a1d483a29f3c24b6c4c"
}
headers = {
"Api-Signature": "<api-signature>",
"Api-Timestamp": "<api-timestamp>",
"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-Signature': '<api-signature>',
'Api-Timestamp': '<api-timestamp>',
'Api-Access-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountId: '6290d9bd-494f-11ed-975e-2e567b4c0e09',
quoteID: '<string>',
side: 'BUY',
allowedSlippage: '0.0005',
idempotentId: '01944c42-5ad3-4108-b376-f78cd6ff0393',
vaultID: '1c920f4241b78a1d483a29f3c24b6c4c'
})
};
fetch('https://api.anchorage-staging.com/v2/trading/quote/accept', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"quoteID": "06f71d1e-e7e8-11ea-adc1-0242ac120002",
"side": "BUY",
"tradeStatus": "EXECUTED",
"tradeID": "d1ae1416-ebd7-11ea-adc1-0242ac120002"
}
}{
"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": "Conflict",
"message": "tradeID=07ceab88-944f-4ea7-9ebf-9d1f5672b59a,tradeStatus=EXECUTED"
}{
"errorType": "UnprocessableEntity",
"message": "The amount requested exceeds credit limit"
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}{
"errorType": "InternalError",
"message": "Missing required field 'amount'."
}Headers
A hex-encoded Ed25519 signature of timestamp_epoch_seconds + uppercase(http_method) + request_path + request_body.
Construction example:
toHex(
ed25519Sign(
signing_key,
'{}{}{}{}'.format(timestamp_epoch_seconds, toUpper(httpMethod), httpRequestPath, httpBody)
)
)
^[0-9A-Fa-f]{128,160}$Body
Request body to accept a quote example:
{
"quoteID": "06f71d1e-e7e8-11ea-adc1-0242ac120002",
"side": "BUY",
}
The maximum slippage Anchorage Digital will consider when accepting this order, communicated in terms of actual value (i.e. "0.001" => 10bps). Must be greater than or equal to 0 and less than or equal to 0.002 (20bps).
In order to illustrate how this setting works, as an example, we shall consider a commission of 10bps for a quote priced at 10000, and that we are about to accept this quote with an allowedSlippage of "0.0008" (8bps). Then, considering the market has moved away from the quoted price, one of the following two scenarios will be applicable:
-
Best market price within allowedSlippage - fill the order at the spread off the market Best Market Price: 10007 Trade Status: Executed Customer Execution Price: 10017.007
-
Best market price outside of allowedSlippage - reject the order Best Market Price: 10009 Trade Status: Rejected
"0.0005"
A client-provided unique ID for idempotent requests (optional). This value must match the one provided to request quote.
128"01944c42-5ad3-4108-b376-f78cd6ff0393"
Was this page helpful?