Get done trades
Goal
Download new trades.
Prerequisites
- Your REST API app.
- Integral API login with trading permission.
- Your organization provisioned to trade with at least one counterparty.
- Done trades that have not yet been downloaded.
Steps
Step 1: Login
Use the Login and get token endpoint.
See the related Login tutorial.
Your access token is in SSO_TOKEN
of the response header. Your token is valid for limited time.
Pass the SSO_TOKEN
cookie value with all of your subsequent API requests.
- https://3ac93db9-6290-458d-9482-0dc0a0e9607a.remockly.com/v2/sso/login
- Payload
- JavaScript
{ "user": "apiUserId", "pass": "This is a long password!", "org": "apiOrganizationId" }
{ "status": "OK", "errorCode": null, "responseTuples": null, "expiryTime": 1665490480729, "serverUTCTime": 1665490420730 }
Step 2: Get done trades
Use the Get trades endpoint.
You get executed trades that have not been downloaded before. The default maximum number of trades returned is determined by the server. You should poll this endpoint until you receive an empty response indicating that there are no more executed trades available for download.
To get trades that have been previously downloaded, you must first call the Prepare trades to resend endpoint.
- https://3ac93db9-6290-458d-9482-0dc0a0e9607a.remockly.com/v2/trades/stp/messages
- Payload
- JavaScript
No request payload
STP download of trade to fill limit order request
[ { "orderId": "4820276016", "tradeId": "FXI9369258100", "tradeType": "Spot", "tradeDate": "2023-06-02", "valueDate": "2023-06-15", "maker": false, "side": "Buy", "status": "Verified", "symbol": "EUR/USD", "currency": "EUR", "customerAccount": "CustomerOrgle1", "customerOrg": "CustomerOrg", "user": "userName@CustomerOrg", "counterparty": "BrokerOrg1", "counterpartyLongName": "The Broker Org", "counterpartyAccount": "BrokerOrg1LE5", "coId": "8932452311944", "channel": "API/REST/ESP", "executionTime": "2023-06-02 18:31:01,301 +0000", "dealtAmount": 1000000, "settledAmount": 1097166.9, "baseAmount": 1000000, "termAmount": 1097166.9, "spotRate": 1.0971669, "rate": 1.0971669, "event": "NEW", "channelCategory": "API", "upi": "EUR_USD_SPOT", "uti": "1234567890AQUSUUINP9349138130" } ]
Step 3: Handle response
If the response contains a list of trades, you should call the endpoint until you get an empty list.
When the response contains an empty list, there are no new done trades to download.