Endpoint to handle Order book operations like creating BID / ASK trades between Tatum Private Virtual accounts, obtaining trade histories, creating futures etc. It is possible to build an exchange based on the Ledger Accounts.
Store new buy / sell trade. If there is trade already available to fill, fill as much trades as possible.
It is possible to charge fees for the trades. Fees are an extra amount on top of the trade amount and are paid in the currency that you going to block
e.g.:
- BUY BTC/USDT - fees will be paid in USDT
- SELL BTC/ETH - fees will be paid in BTC
If you fill type of the trade with FUTURE_BUY or FUTURE_SELL the trade will behave as a trade future. The trade is concluded now but will be fulfilled in future. The date of fulfillment is by the “Seal Date” field. You can also block a percentage of the amount until the future trade has expired.
Futures can also penalize contracting parties if they don’t have the agreed balance available in their accounts. The penalty is calculated in the following way: Penalty amount = (Percentage of incomplete deal amount because of shortage from user) × (Maximum Penalty percentage of futures deal based on blocked amount and time interval) × (total blocked value).
Example of the BTC/USDT trade future:
The maker creates a sell with the following properties: 1 BTC at a price of 60000 USDT, with a blocking percentage of 22%, a penalty percentage of 45%, a system commision of 1% and with an expiration time of within 12 hours.
{ "type": "FUTURE_SELL", "price": "60000", "amount": "1", "pair": "BTC/USDT", "currency1AccountId": "60a236db1b57f60d62612bf3", "currency2AccountId": "609d0696bf835c241ac2920f", "fee": 1, "feeAccountId": "609d0696bf835c251ac2920a", "attr": { "sealDate": 1621990960631, "percentBlock": 22, "percentPenalty": 45 } }
The taker accepts the offer with a buy and blocks 13200 USDT (60000 USDT × 0.22) in their account.
{ "type": "FUTURE_BUY", "price": "60000", "amount": "1", "pair": "BTC/USDT", "currency1AccountId": "60a236db1b57f60d62612bf2", "currency2AccountId": "609d0696bf835c241ac2920a", "attr": { "sealDate": 1621990960631, "percentBlock": 22, "percentPenalty": 45 } }
At the time of the trade, the maker and taker have the following conditions. The maker has 0.65 BTC (35% deficit) in their account and the taker has 49200 USDT (18% deficit) in their account.
The maker penalty is equal to 0.35 × 0.22 × (0.45 × 1 BTC) = 0.03465 BTC. The taker penalty is equal to 0.18 × 0.22 × (0.45 × 60000 USDT) = 1069.2 USDT.
The system commission for the maker is 1 BTC × 1% = 0.01 BTC. The system commission for the taker is 60000 USDT × 1% = 600 USDT.
The maker’s assets after deducting penalties and commissions equals 0.65 - 0.03465 - 0.01 = 0.60535 BTC. The taker’s assets after deducting penalties and commissions equals 49200 - 1069.2 - 600 = 47530.8 USDT.
The amount received by the maker after the trade is (0.60535 × 60000) + 1069.2 = 37390.2 USDT and the taker receives 0.60535 + 0.03465 = 0.64 BTC.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions.
Internal server error. There was an error on the server while processing the request.
{- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1"
}
{- "id": "5e68c66581f2ee32bc354087"
}
Obtain data from the closed trades for entering in the chart. Time interval is set between from and to and there is defined time frame. There can be obtained at most 200 time points in the time interval.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "pair": "BTC/EUR",
- "from": 1613654998398,
- "to": 1613654998398,
- "timeFrame": "MIN_5"
}
[- {
- "timestamp": 1613654117167,
- "high": "54213.21",
- "low": "53213.54",
- "open": "53513",
- "close": "54113",
- "volume": "2.423"
}
]
List all historical trades. It is possible to list all trades, trades for specific trading pair and/or account.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all historical trades. It is possible to list all trades, trades for specific trading pair and/or account.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "pageSize": 10
}
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all active buy trades.
OK
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all active buy trades.
OK
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "pageSize": 10
}
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all active sell trades.
OK
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all active sell trades.
OK
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "pageSize": 10
}
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
List all matched orders from the FUTURE_BUY OR FUTURE_SELL orders.
OK
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "pageSize": 10
}
[- {
- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
]
Get existing opened trade.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "id": "7c21ed165e294db78b95f0f1",
- "type": "BUY",
- "price": "8650.4",
- "amount": "15000",
- "pair": "BTC/EUR",
- "isMaker": true,
- "fill": "1500",
- "feeAccountId": "7c21ed165e294db78b95f0f1",
- "fee": 1.5,
- "currency1AccountId": "7c21ed165e294db78b95f0f1",
- "currency2AccountId": "7c21ed165e294db78b95f0f1",
- "created": 1585170363103,
- "attr": {
- "sealDate": 1572031674384,
- "percentBlock": 1.5,
- "percentPenalty": 1.5
}
}
Cancel existing trade.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "errorCode": "validation.failed",
- "message": "Request validation failed. Please see data for additional information.",
- "statusCode": 400,
- "data": [
- {
- "target": {
- "property": 12345
}, - "value": 12345,
- "property": "property1",
- "constraints": {
- "min": "property1 must not be less than 50000"
}
}
]
}
Cancel all trades for account.
OK
Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.
Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
Internal server error. There was an error on the server while processing the request.
{- "errorCode": "validation.failed",
- "message": "Request validation failed. Please see data for additional information.",
- "statusCode": 400,
- "data": [
- {
- "target": {
- "property": 12345
}, - "value": 12345,
- "property": "property1",
- "constraints": {
- "min": "property1 must not be less than 50000"
}
}
]
}