Ideal time gap to fetch latest 5 minute data from Historical Data

Hi Team,

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.
  • milli
    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.
  • arundonni17
    Thanks milli.
    @sujith, can you confirm on the same?
  • sujith
    You can know more here.
  • arundonni17
    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.
  • arundonni17
    @sujith .. Can you please give more clarity on my above query.
  • sujith
    We have explained everything in the above-mentioned thread. You can go through that.
  • mijanur
    @arundonni17 solution for this issue is set a callback function till data available
  • arundonni17
    Thanks for the help.
This discussion has been closed.