Incorrect Historical Data

Im not sure if Im doing something wrong here but I am getting incorrect historical data when I make calls during the trading day.

I made API calls for historical data for the 15m period at 3:00PM and 3:15PM for INFY, ADANIPOWER and TVSMOTOR. As you can see below the OHLC are all incorrect.

If I make the same API call after the market closes I get the correct data.

Why is this happening? How can I get accurate 15m period data in real time. For instance, at 3:00 PM (or any other time during trading) I want to get the 15/60/10/5m period data.

# date, open, high, low, close, volume, symbol
'2017-06-01 03:15:00', '971.95', '973', '971.95', '972.9', '18733', 'INFY'
'2017-06-01 03:00:00', '968.55', '969.9', '968.4', '969.5', '16418', 'INFY'

# date, open, high, low, close, volume, symbol
'2017-06-01 09:45:00', '27.1', '27.1', '26.8', '26.9', '1315571', 'ADANIPOWER'
'2017-06-01 09:30:00', '27.05', '27.1', '27', '27.1', '349060', 'ADANIPOWER'

# date, open, high, low, close, volume, symbol
'2017-06-01 09:45:00.000000', '535.4', '535.4', '534', '534', '10527', 'TVSMOTOR'
'2017-06-01 09:30:00.000000', '533.5', '534', '533.5', '533.5', '1749', 'TVSMOTOR'

  • sujith
    Hi @traderx,
    A candle for 3:00 PM to 3:15 PM is constructed after we get all ticks of 3:15 PM. You can't fetch 3:00 to 3:15 PM candle before 3:15 PM.
  • traderx
    Please can you explain to me whats going on here...

    Here are some historical requests that I made at today for INFY 15m period

    10:02 AM - INFY
    {'high': 970.95, 'volume': 6806, 'low': 970.35, 'date_time': u'2017-06-02T10:00:00+0530', 'close': 970.35, 'symbol': u'INFY', 'open': 970.7, 'period': '15m'}\

    10:04 AM INFY
    {'high': 970.95, 'volume': 13683, 'low': 969.1, 'date_time': u'2017-06-02T10:00:00+0530', 'close': 969.2, 'symbol': u'INFY', 'open': 970.7, 'period': '15m'}

    10:05 AM
    fetch_data: {'high': 970.95, 'volume': 14700, 'low': 969.1, 'date_time': u'2017-06-02T10:00:00+0530', 'close': 970, 'symbol': u'INFY', 'open': 970.7, 'period': '15m'}

    Can someone tell me why this is happening ASAP ! I dont expect historical prices to change. Am I doing something wrong?

  • traderx
    @sujith please see my comment above
  • traderx
    @sujith look at the close prices
  • traderx
    Im assuming the 10:00 AM candle is for 9:45 AM to 10:00 AM and thus should be already constructed.. So why is it changing at 10:02 and 10:03 right up until 10:15 after which it seems stable
  • sujith
    Hi @traderx,
    Please ignore the above comment.
    If you request for 15 min candle at 10:07 AM then API will give you data with the last candle of time interval 10:00 AM to 10:15 AM. Since 10:15 AM has not lapsed. The last candle is constructed with the data that is available.
    Let me elaborate, 15 min candle will have OHLCV for the scrip in that 15 minutes, we need to construct candle with open price of that interval, close of that interval, high of that interval and low of that interval. After a new tick arrives, if LTP is higher than high of that 15min then high is updated. Same goes for low price value also.
  • traderx
    Ok that makes sense. Thanks a lot.
This discussion has been closed.