ohlc Api returns same last_price and close

ohlc Api returns same last_price and close. Shouldn't the close price be previous close?

{'data': {'NSE:3MINDIA': {'instrument_token': 121345,
'last_price': 20824.5,
'ohlc': {'close': 20824.5, 'high': 20990, 'low': 20600.1, 'open': 20780}},
'NSE:8KMILES': {'instrument_token': 2830849,
'last_price': 151.75,
'ohlc': {'close': 151.75, 'high': 167.35, 'low': 151.45, 'open': 164.2}},
'NSE:ABB': {'instrument_token': 3329,
'last_price': 1345.6,
'ohlc': {'close': 1345.6, 'high': 1358, 'low': 1304.95, 'open': 1305}},
'NSE:ACC': {'instrument_token': 5633,
'last_price': 1458.65,
'ohlc': {'close': 1458.65, 'high': 1467, 'low': 1450.4, 'open': 1455}},
'NSE:AIAENG': {'instrument_token': 3350017,
'last_price': 1659.3,
'ohlc': {'close': 1659.3,
'high': 1679.8,
'low': 1646.35,
'open': 1667.05}}},
'status': 'success'}
  • sujith
    It will give return the same data when markets are not opened.
    You can try it now.
  • girish400
    ok. Thank you!
  • sujith
    To add more info, the OHLC method returns OHLC of the day and not any intraday interval.
    You need to use historical data to fetch historical OHLC data.

    For live market strategies, we suggest using websocket data to generate OHLC data at your end.
    You can get started from here.
  • girish400
    Historical API returns data for one instrument at a time. I want to have previous days close and ltp for multiple instruments at a very specific time.
    Rest assured am not pooling API and using WebSocket as required.
  • sujith
    You can use OHLC method or websocket according to your requirement.
    The getOHLC will return previous close and last traded price.
Sign In or Register to comment.