Hi
I am testing in the UAT environment for a couple of changes we need for next release. I am trying to get fills for an account.
For Positions, this works fine:
https://apigateway.trade.tt/monitor/ext_uat_cert/position?requestId=daytradr-JigsawTrading--a40d85d5-32c5-4b4a-a12e-dbe094b84b7e& accountId=G1112345
https ://apigateway.trade.tt/ledger/ext_uat_cert/fills?minTimestamp=1580199670504650200&requestId=daytradr-JigsawTrading--bf7364cf-2c80-44f3-a542-f7d58d327fd0
https ://apigateway.trade.tt/ledger/ext_uat_cert/fills?minTimestamp=1580199809519138200&requestId=daytradr-JigsawTrading--c5efba77-d0a3-479d-943b-bd643fe46e6e& accountId=G1112345
Answer by trishmessina · Feb 26, 2020 at 03:09 PM
@peterdavies It looks like you are specifying the account name G1112345 rather than the account id (a number). The positions query might be 'working' by ignoring the parameter and giving you all your positions. The fill query is rejecting it. You can get the account id via the /accounts request.
Answer by peterdavies · Feb 26, 2020 at 04:55 PM
Thanks for that @trishmessina- I'm almost there.
In order to ensure proper synching of fills & positions we are doing this:
1 - Get positions for account a
2 - Get fills for account a
3 - Get positions for account a again
4 - Gets fills for account a again
That way if the lists 1&3 match and the lists 2 & 4 match, we know there was no fill that came in while we were processing.
The problem we are having is that step 3 fails with:
Error : ProtocolError Error Message :System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
You'll need to download the image - but you can see here - two yellow highlighted requests for positions that are ok and one blue highlighted request for position that's not OK and fails after almost 30 seconds.
Any ideas
@peterdavies It looks like that request timed out. I would suggest doing a retry on the 500 error a couple times, perhaps with a slight delay, before failing your processing. This then would account for any idiosyncrasies happening on the back end server.
To make sure your data is synced, you need to loop your four steps until your sync conditions are true. Have you considered using the .Net SDK for your app? It will synchronize the order book/positions and send you all the fills for the current session. In addition, it will send the position updates and modifcations (when SOKs are created for example) and fills in real time. You can use the REST API in an SDK app if need be as well.
Be aware, the REST API does have request limits (so many a second and so many a day) so make sure to code around those possible 429 responses.
Answer by AndrewR · Feb 27, 2020 at 02:18 PM
@peterdavies - We are aware of some timeout issues that are occurring only in the UAT environment. We are actively working on a fix. Apologies for the inconvenience.
Ask questions and share ideas about the TT® and X_TRADER® platforms.
First time here? See our Getting Started Guide and FAQs.
TT Rest API 2 Answers
TTREST - No Support -is it ready for Prime Time? 1 Answer
TT Rest API 1 Answer
© 2017 Trading Technologies International, Inc. All rights reserved.
Powered by AnswerHub