Able to fetch data for futures and options but Not stocks in Python via websocket

Trader I. shared this problem 5 months ago
Not a Problem

I'm able to fetch data for Options and futures, but not stocks. can you please help me understand what is wrong?

I've pasted the inputs and outputs. error is in the line td_obj.get_historic_data(symbol, duration, bar_size).

Thanks

symbol

Out[90]: 'RELIANCE'

duration

Out[91]: '3 D'


bar_size

Out[92]: '5 mins'


td_obj.get_historic_data(symbol, duration, bar_size)

Traceback (most recent call last):


File "<ipython-input-93-f6a20db1a911>", line 1, in <module>

td_obj.get_historic_data(symbol, duration, bar_size)


File "C:\ProgramData\Anaconda3\lib\site-packages\truedata_ws\websocket\TD.py", line 463, in get_historic_data

return self.get_historical_data_from_duration(contract=contract,


File "C:\ProgramData\Anaconda3\lib\site-packages\truedata_ws\websocket\TD.py", line 496, in get_historical_data_from_duration

assert type(end_time) == datetime


AssertionError

Comments (2)

photo
1

Please try again as this is not an issue at all.

This may have happened during maintenance timings.

I have fired the request and do not find any issue.

Please fire the same request again and let us know if you still facing any issues.

photo
1

Hi Aditya. Quite an old thread, but the root cause was using bar_size as a variable. since it is part of the function parameters, it was failing. changed it to bar_size=barsize(or any other variable name) and worked.

Leave a Comment
 
Attach a file