Historical API from and to timestamps

yoursvsr
yoursvsr edited February 2022 in API clients
Hi Team,

Just want a clarification regarding how historical API treats the 'from' and 'to' params passed to it.

e.g. I want one 5minute candle for an instrument for say, 9:40am. I pass in the time components for the from and to dates (both dates will be same which is today) as 9:40 (from) and 9:45 (to).

If I call this at 9:46, the interval being 5minute, how many candles would I get from the historical API? One candle with 9:40 timestamp or two candles with 9:40 and 9:45 timestamps? Will the results be different if I call the same at 9:51?

TIA.
Tagged:
  • sujith
    @yoursvsr,
    We don't recommend using historical data API for live strategies. Historical data API is provided only for backtesting purposes.
    You need to generate candles at your end using the live market data provided via Websocket API. You can know more here.
  • yoursvsr
    Duly noted.

    Now, can you please answer my question?

    Thank you.
  • SRIJAN
    SRIJAN edited February 2022
    @yoursvsr Kite stores data in minute candles,all higher timeframes are made by grouping the minute candles. So to get 9:40 candle,your from would be 9:40 and to will be 9:44. If you pass to as 9:45 at 9:46,the response will have 2 candles,one the completed candle of 9:40 and second,the candle till the end of the first minute(9:45) of the running candle of 9:45. The result will be same if you call at 9:51 with the same from & to or later ,the response depends on the from and to params,not when you call the function.
  • yoursvsr
    Thanks for the quick response. Have a good day.
Sign In or Register to comment.