How can i get CLOSE Price on a particular minute by using historical API?

1krishnagupta
I want to fetch CLOSE PRICE by using historical API, on any date or any time. but I don't understand which function should use or how I have to use that function.
Please guide me about this problem.
  • sujith
    You looking for live intraday candles?
  • 1krishnagupta
    1krishnagupta edited February 2022
    @sujith no sujith, i'm looking for historical data.
    assume I want CLOSE PRICE on 12-03-2021 09:50:59 time on (BANKNIFTY 33000 STRIKE DATA / or may be I can use instrument token)
  • sujith
    ok, you need to narrow down the interval and make a historical data api call or make candle data, store it in your db and fetch that.
  • 1krishnagupta
    1krishnagupta edited February 2022
    @sujith, I tried this method, is it correct?
    from_date = datetime.strptime('2021-12-15 10:30:59', '%Y-%m-%d %H:%M:%S')
    to_date = datetime.strptime('2021-12-15 10:31:59', '%Y-%m-%d %H:%M:%S')
    historical_data = kite.historical_data(instrument_token=str(i),from_date=from_date,to_date=to_date,interval='minute', oi=True)
    historical_data
    output -
    [{'date': datetime.datetime(2021, 12, 15, 10, 31, tzinfo=tzoffset(None, 19800)),
    'open': 37324.15,
    'high': 37324.15,
    'low': 37279.6,
    'close': 37279.6,
    'volume': 25,
    'oi': 37175}]
  • SRIJAN
    SRIJAN edited February 2022
    Yes. Actually,the seconds value doesn't matter,so you don't need that. Kite stores data in minute candles. So,you will get minute candles only even if you pass seconds value.
Sign In or Register to comment.