ERROR: Your request failed with error "No Data!"
Hi,
The error in subject line comes from hist api when no data is available for the symbol requested. Two points on this message.
1. This is a print message from get_n_historic_bars, get_hist_bar_data, get_hist_eod_data, etc functions inside TD.py code of the truedata_ws library. Instead of a print, can this be 'raised' so that client python code can catch it in a try except block? Otherwise this print message comes in the main thread where more emergency print statements may be there.
2. This message comes when there is no data for the symbol. Can it be changed to a warning or info message when symbol is correct but data is absent. And an error message if symbol is incorrect. If symbol is correct, should the api not send back the last ohlc data which will be o=h=l=c as we see in broker charts?
Thanks
Arindam
From the Python Library, this is the return you are getting when you have asked for some symbol (which is correct) for some time period where there is no data for that symbol during the requested time period.
So here you are being returned an Empty list.
What you can do is check for the length of the return. This will help you process the 'No Data' return efficiently and without breaking any code.
From the Python Library, this is the return you are getting when you have asked for some symbol (which is correct) for some time period where there is no data for that symbol during the requested time period.
So here you are being returned an Empty list.
What you can do is check for the length of the return. This will help you process the 'No Data' return efficiently and without breaking any code.
I do check for the the empty df and that is how my code works without breaking. I am pointing that the td library function also prints the error without raising an error or warning. Which results in messages in my main thread. I would rather have a try catch section to process this in my side than a print statement and empty df. I think that will be best practise coding anyway?
Above is about asthetics and non functional, purely technical.
However a functional question here will be, if the symbol is correct and there is no data, should it not return ohlc as same as last available close in the requested time frame?
I do check for the the empty df and that is how my code works without breaking. I am pointing that the td library function also prints the error without raising an error or warning. Which results in messages in my main thread. I would rather have a try catch section to process this in my side than a print statement and empty df. I think that will be best practise coding anyway?
Above is about asthetics and non functional, purely technical.
However a functional question here will be, if the symbol is correct and there is no data, should it not return ohlc as same as last available close in the requested time frame?
... try / except
... try / except
Replies have been locked on this page!