How many past days historical data can be fetched for minute candle

WN1867
Hi, I had a used case where I was fetching minute by minute historical data for stocks.
I had coded it in such a way that:
todate = assume as todays date and current time
fromdate = todays datetime minus 6days

and after every loop:
todate = previous fromdate - 1day
fromdate = todate - 6days
using the above logic I was looping for about 320 loops to get the last 5 years available historical data
First loop example:
fromdate = 04-01-2021
todate = 08-01-2021
So basically, it should return historical data from the given date but it only returns historical data for the past 4 trading days.
Is there any limit on the number of days for fetching 1minute historical data ??
  • sujith
    sujith edited January 14
    The historical data API is provided for backtesting purposes only. You need to build candles at your end using the Websocket API data for live market strategies. You can know more about building ticks here.

    For the query about the availability of the historical data. You can check out the FAQs here.
  • WN1867
    Hi Sujith, thanks for your help but I think you didn't get my problem.
    I am already subscribed to historical API and for backtesting purposes, I tried to fetch past 4or 5-year historical data for a stock/index by hitting multiple requests.
    My main question is that in a single request to API I am trying to get 1minute historical data for at least the past 5 days but it only returns 1minute historical data for 4 trading days and then in the next request it returns for the next 4 trading days. So, is there any limit TO THE API where it returns 1MINUTE HISTORICAL DATA FOR 4 TRADING DAYS IN ONE REQUEST???
  • rakeshr
    So, is there any limit TO THE API where it returns 1MINUTE HISTORICAL DATA FOR 4 TRADING DAYS IN ONE REQUEST???
    Yes, we have a limit for all candle periods. You can check each candle limitation for a single request in this thread.
  • WN1867
    Hi Rakesh, as per the documentation we can fetch 60days of data for a 1minute interval in a single request but as I have explained above I tried to fetch 5-6days of data in a single request but it gives back only 4days of data
    even though all 5 days are trading days without any holiday.
  • sujith
    Can you run in debug mode and paste the complete request and response here?
    PS: Make sure to remove all app and client-specific information.
Sign In or Register to comment.