I went through many threads, where you say using historical api for live market strategy is not recommended. However if I still want to go ahead and use historical api, when should I be ideally calling the api to get the latest 5 minute candle? For example if want to get the data for 9:15-9.20 then I should call the api at 9:21 or 9:22 to be sure that I get the 9:15-9:20 data.
You can 'start' trying to get the data at say 09:21:01 .
If you use Python & Pandas, you can check the length of the dataframe. If it is zero, then you will have to request the data again. To be doubly sure, you can also check the first and last time element of the dataframe.
I had checked on that link before. You have mentioned there "It is not guaranteed that a minute candle will be available at the end of the minute or at the beginning of the next minute". I just wanted to know the ideal time gap that would be sufficient to ensure we get the latest data.
If you use Python & Pandas, you can check the length of the dataframe. If it is zero, then you will have to request the data again. To be doubly sure, you can also check the first and last time element of the dataframe.
@sujith, can you confirm on the same?
You can know more here.