Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when passing both toDate and fromDate in options() #90

Open
roysta2004 opened this issue May 14, 2020 · 1 comment
Open

Error when passing both toDate and fromDate in options() #90

roysta2004 opened this issue May 14, 2020 · 1 comment
Labels
backlog Issues that haven't been categorized or are not yet ready for work bug Concrete, reproducible bugs

Comments

@roysta2004
Copy link

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)

@roysta2004
Copy link
Author

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 timkpaine added backlog Issues that haven't been categorized or are not yet ready for work bug Concrete, reproducible bugs labels Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issues that haven't been categorized or are not yet ready for work bug Concrete, reproducible bugs
Projects
None yet
Development

No branches or pull requests

2 participants