historical_data

atulseth404
Hey! I am trying to get historical_data for less than 60 days for the interval of 30 mintues. But it is flagging an error of "Invalid interval". Day interval is working but not "30 minute". Please help!!

instrument_token = 3465729
from_date = datetime.datetime(2020,5,5,9,15,0)
to_date = datetime.datetime(2020,5,8,15,30,0)
hist_data = kite.historical_data(instrument_token, from_date, to_date, interval = "30 minute", continuous=False, oi=False)
pprint(hist_data)

Traceback (most recent call last):
File "C:\Users\LENOVO\Desktop\Python_works\check_data.py", line 19, in
hist_data = kite.historical_data(instrument_token, from_date, to_date, interval = "30 minute", continuous=False, oi=False)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python37\lib\site-packages\kiteconnect\connect.py", line 630, in historical_data
"oi": 1 if oi else 0
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python37\lib\site-packages\kiteconnect\connect.py", line 817, in _get
return self._request(route, "GET", params)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python37\lib\site-packages\kiteconnect\connect.py", line 886, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: invalid interval
  • rakeshr
    @atulseth404
    hist_data = kite.historical_data(instrument_token, from_date, to_date, interval = "30 minute", continuous=False, oi=False)
    You need to send interval parameter as 30minute(without space) not as 30 minute. Go through complete interval params detail here.
Sign In or Register to comment.