You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use just toDate, or just fromDate, everything returns as expected. But when I pass both, I get this error:
Traceback (most recent call last):
File "D:\tools\Python\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
return self._engine.get_loc(key)
File "pandas_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'tradeTimeInLong'
I did some more research on this. OptionsDF does not handle a status back of 'FAILED' from TDA. It just assumes a success and then tries to convert the columns to datetime, and they do not exist, thus throwing the error.
timkpaine
added
backlog
Issues that haven't been categorized or are not yet ready for work
bug
Concrete, reproducible bugs
labels
Jun 15, 2020
If I use just toDate, or just fromDate, everything returns as expected. But when I pass both, I get this error:
Traceback (most recent call last):
File "D:\tools\Python\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
return self._engine.get_loc(key)
File "pandas_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'tradeTimeInLong'
My code is as follows:
toDate = date.today()+timedelta(days=max_days_to_consider)
fromDate = date.today()+timedelta(days=min_days_to_consider)
tdclient.optionsDF(stock, includeQuotes = True, contractType='PUT', range='OTM', fromDate=fromDate, toDate=toDate)
The text was updated successfully, but these errors were encountered: