BankNifty Historic data for last 5yrs - Issues

Soutir
Hi,
I am not sure if this is already discussed in this forum. I couldn't find the answer, hence posting the issue.
While trying to fetch historic data it's only allowing me to fetch last 200 days data only. It's not allowing me to fetch more than 200 days.

Code:
token = 260105
to_date = datetime.datetime.now()
from_date = to_date - datetime.timedelta(days = 300)
interval = "15minute"
records = kite.historical_data(token, from_date, to_date, interval)

Error:
kiteconnect.exceptions.InputException: interval exceeds limit: 200 days

Kindly let me know, how to resolve this issue and pull 5yrs data.
  • rakeshr
    @Soutir
    kiteconnect.exceptions.InputException: interval exceeds limit: 200 days
    There are limitations for fetching historical data for the all candle intervals in single request. You can look to Historical data FAQ.
    Kindly let me know, how to resolve this issue and pull 5yrs data
    You need to loop-in with multiple 200 days fetch for the required period.
  • Soutir
    Thanks @rakeshr for your response!! I will use loop to fetch data and let you know in case of any issue.
This discussion has been closed.