Unable to get BankNifty historical prices on certain dates

vijaynair
vijaynair edited September 2022 in Python client
I am unable to get BankNifty historical data for many of the days (able to get Nifty prices though). What could be the reason?

For ex: The following is not returning anything for BankNifty, but Nifty works. Attempting to get 1 day price only.
date = "01022017"    # Date format should be - DDMMYYYY 
from_date = datetime.strptime(date, '%d%m%Y')

historical_data = kite.historical_data(instrument_token=str(256265),from_date = from_date, to_date = from_date, interval='day')
token_df = pd.DataFrame(historical_data).close[0]
  • sujith
    sujith edited September 2022
    @vijaynair,
    Showing fine for me for the Banknifty index(260105) for date = "01022017" .
    2017-02-01 00:00:00+05:30,19522.4,20047.85,19470.95,20020.6
    You need to re-check if you are sending correctly from and to dates.
  • vijaynair
    Yes @sujith
    About my query, I am able to get Nifty prices for the said date, but not BankNifty.
    Any idea?
  • vijaynair
    vijaynair edited September 2022
    Thank you @sujith It's working now. Don't know what happened lol
This discussion has been closed.