Open AndrewRoskamp opened 3 years ago
Could be that it's missing an additional key. When I read the documentation, it looks like if you do just the date then you need to specify an additional key. Here is what they are:
"cancelTime": {
"date": "string",
"shortFormat": false
}
Can you print out the raw JSON and see if those keys are both in there.
It does look like those fields are present - you add them in the Order class. fwiw, I also tried changing that code to put 'false' in lieu of the actual bool value, and that didn't work either.
>>> json
OrderedDict([('cancelTime', {'date': '2020-12-14T14:30:00', 'shortFormat': False}), ('duration', 'GOOD_TILL_CANCEL'), ('orderLegCollection', [{...}]), ('orderStrategyType', 'SINGLE'), ('orderType', 'LIMIT'), ('price', 20.0), ('session', 'NORMAL')])
Any news on this?
@areed1192 what is the format for cancelTime dates???
Not sure if anyone else is still looking for this. The TDAmeritrade documentation is incorrect. cancelTime : string
is the correct answer. It uses uses 'yyyy-MM-dd' format and is not an object as documented. Hopefully this helps. I did not try setting any shortFormat
.
Hi! It seems like specifying a cancel_time to order_duration will prevent the order from being submitted (unless I can't figure out what datetime format TDA expects). Whatever I put in that field will cause Ameritrade to issue a "A validation error occurred while processing the request." response. I am able to successfully submit orders without specifying a cancel_time.
Thanks!