TradeViaPython / Kite_Zerodha

156 stars 108 forks source link

Intervals in historical data fetch #16

Open rohitpsk opened 1 year ago

rohitpsk commented 1 year ago

Where can i find intervals available for historical data fetch. I am unable to get data for one minute

coprem commented 11 months ago

@rohitpsk you can use 'minute', 'day', '3minute', '5minute', '10minute', '15minute', '30minute', '60minute' for respective intervals.

Example Code:

from datetime import*

interval = 'minute'
Instrument = 'NSE:HDFCBANK'
Instrument_token = kite.ltp(Instrument)[Instrument]['instrument_token']
from_date = datetime(2023, 7, 31, 8, 40, 00)
to_date= datetime(2023, 8, 1, 8, 40, 00)
kite.historical_data(Instrument_token, from_date, to_date, interval)