td-ameritrade-python-api
td-ameritrade-python-api copied to clipboard
the order status from api is wrong
Has anyone encountered this problem?The order status synchronized from the api is different from the order status on thinkorswim.
for example:
Below is the order status of thinkorswim
the status from the get order api:
It seems that the API has a high latency.
looking forward to you reply, thank you.
Did you authenticate using an access token or just the apikey? Using an apikey will have a delayed response.
I have used the access token
The API doesn't ingest data from Thinkorswim, it ingests it directly from TD. Try comparing the order flow data you are getting to that from TD, as there may be a slight delta.
While they "should" be the same, there are noticeable occassions where TD data is different than Thinkorswim data. Example being options chain values.
@Dro92 Could you help me out with the credentials_path? When I run the script, I get the follow error: 'The credential file does not contain expiration times for your tokens, please go through the oAuth process.' Because my json file is never created.
@Dro92 Could you help me out with the credentials_path? When I run the script, I get the follow error: 'The credential file does not contain expiration times for your tokens, please go through the oAuth process.' Because my json file is never created.
Might want to take this discussion off this ticket and make a new one, but try verifying that your config.py is proper. It should have a field JSON_PATH = 'your/path'
@Dro92 It started working when I used a new callback URL. Thanks
I can confirm unusual order status values received from the API, but it's unrelated to this library and I don't see a way to fix it. Orders that I clearly cancelled and even received the cancelled callback for are still showing status = 'QUEUED' even the next day when I request the order details. Seems like a TD bug unfortunately.
@Jmarks199 I have send emails to [email protected] and find the reasons: The messaging delays are more than likely related to having advanced features enabled on your account. The solution is: send email to [email protected] to turn off the advanced features of thinkorswim.
Yeah, you have to be careful when trying to compare operations using the API and operations in Thinkorswim. They are two different servers and have two different APIs, so you'll often find that information doesn't match.