Fyers API Issue - Historical Data access of Index

Facing an error while trying to fetch historical data. Any change that we need to make here? It is working for EQ. Not working for any index

My code is as below

data = {

    "symbol":"NSE:NIFTYBANK-INDEX",

    "resolution":"5",

    "date_format":"1",

    "range_from":"2024-02-09",

    "range_to":"2024-02-09",

    "cont_flag":"1"

}

fyers.history(data=data)

getting error {‘s’: ‘error’, ‘code’: -300, ‘message’: ‘Please provide a valid symbol’}

Hey @abhijit_j

Could you please let us know if you are using API V2 or V3 ?

Hi Abhishek,

I was using older version. Works properly with V3. Thank you for resolving.

facing same issue with NSE:NIFTYBANK-INDEX symbol for other symbol it’s working fine

@abhijit_j
any solution for this

@102319960478148405959, we need to route the API request to the v3 endpoint, v2 appears deprecated by Fyers.

https://api-t1.fyers.in/data/history?symbol=NSE:BANKNIFTY-INDEX&resolution=D&date_format=1&range_from=2024-01-31&range_to=2024-02-05&cont_flag=0

This is working fine. You can refer v3 docs for more info - Fyers v3 API Docs