Listing Closed Trades (4/4)
Listing Closed Trades with Virtual Accounts
When the trade is closed, there are two ledger transactions:
- The first one is between accounts of the trading pair's first currency.
- The second one is between accounts of the second currency in the trading pair.
In the BTC/ETH example (seen in the article: Introducing Trading), there is a ledger-to-ledger transaction of BTC and a ledger-to-ledger ETH transaction. Blockages on both trades are deleted, the trade is not active anymore, and it is moved to historical trades.
Steps
Step_1: List closed trades
Request example:
curl --request POST \
--url https://api.tatum.io/v3/trade/history \
--header 'x-api-key: {YOUR_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"pageSize": 50,
"offset": 0
}
'
//Response:
[
{
"created": 1609617722713,
"amount": "1",
"price": "40",
"fill": "1",
"type": "BUY",
"pair": "BTC/ETH",
"currency1AccountId": "5f914e372e47312bc56d8d3d",
"currency2AccountId": "5f914e0a2e47312bc56d8d3b"
"fee": null,
"feeAccountId": null,
"id": "5e68c66581f2ee32bc354087"
}
]
Step_2: Review the trades
- Considering the response from Step_1, you can see that the only difference is the fill property, which is the same as the trade amount (seen in the article: Listing Open Trades).
Updated 6 months ago