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.
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
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.
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.
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?
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.