historical data fetching only one todays data for f&o

I am using python kiteconnect module to fetch historical data for options of expiry 29th April despite giving To date: 2021/04/21 From date: 2021/04/27 i am able to fetch historical day for present day only please assist
  • tonystark
    Could you post the code snippet?
  • pavankumarhu
    //have already fetched instruments list and stored it in dataframe
    def instrumentLookup(instrument_df,symbol):
    """Looks up instrument token for a given script from instrument dump"""
    return instrument_df[instrument_df.tradingsymbol==symbol].instrument_token.values[0]
    return -1

    // function which returns historical data taking interval and duration instrument lookup is used to fetch instrument id
    def fetchOHLC(ticker,interval,duration):
    """extracts historical data and outputs in the form of dataframe"""
    instrument = instrumentLookup(instrument_df,ticker)
    data = pd.DataFrame(kite.historical_data(instrument,dt.date.today()-dt.timedelta(duration),
    return data

  • sujith
    We need exact params to help you out. You can run kiteconnect in debug mode and share the logs.
    Make sure to remove client and app specific tokens.
  • pavankumarhu
    Thankyou sujith for looking into the issue i found it there was a wrong date parameter sent between the functions .
This discussion has been closed.