How to fetch open of running candle in dataframe using kite historical data on 1 minute timeframe?

Madhur
Suppose time is 9.16.01 am. I have download 1 minute historical data. It will show data of upto 9.16 am. But when I run again in loop at 9.17.01 am, the last candle will be shown 9.16 am instead of 9.17 and same thing continues. It will show running candle right in 1 iteration but the wrong in another iteration. It is happening in every timeframe. The Historical data is not showing accurate data pertaining to running candle. My main aim is to download open of the running candle in pandas df.
I am using datetime module to run iteration at particular time limit

if (datetime.now().second == 2) and (datetime.now().minute % 1 == 0):
data = kite.historical_data(instrument_token = token , from_date = from_date , to_date = to_date , interval = interval , continuous=False, oi=True)
df = pd.DataFrame(data)
  • rakeshr
    This thread explains more on your query.
    We don't recommend using historical data for live pooling. We suggest generating candles at your end using the live market data provided via Websocket. A few of the resources regarding the same can be found here.
Sign In or Register to comment.