Get historical price of Nifty Future contracts


  • Hello Traders,
    I would like to fetch the historical price for Nifty future contracts from 2020 till date.
    What I am looking to is for e.g. starting from January 1st, 2020, I would like to get the nifty current month contract price and so on for each subsequent month. After every monthly expiry, the next month becomes the current month!
    How can I do that with smartapi?


  • @jaskirat1208 Appreciate you taking time to respond.
    Though, my issue is not what you suggested.

    I am looking to fetch "historical" Nifty & BankNifty futures contract prices for e.g. from 1 Jan 2018 onwards.

    Usually these are only in monthly contracts (current month, near & next month), but if we refer to TradingView there we have a continuous current month contract which gives intraday candle data since almost 2 years or so.
    I want that feed if possible from AngelOne coz they are my broker. I won't rely so much on TradingView historical data.


  • @falconTrader I'm not an admin, but I think I can help you here.

    This function gives you all the upcoming expiry dates for a symbol since the first date.

    $ pip install nsepython
    $ python
    > nsepython.expiry_list('NIFTY') # Can enter banknifty, finnifty, etc as per convenience
    

  • @admin @administrators any guidance on the subject please?