Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    How to get old expiry dates of banknifty and nifty for backtesting?

    Python SDK
    0
    4
    41
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mitrajit last edited by

      Hi,

      I'm writing a banknifty strategy in python. In the running market I'm getting current expiry dates as well as future expiry dates from the below link -- https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json

      But I need the old expiry dates for backtesting which are already past.
      For getting ltp I need to prepare the tradingsymbol (BANKNIFTY19JUN2450000PE) which consist of symbol, expiry date, strike price and CE/PE which will return me the token.

      Using token and tradingsymbol we can get the ltp from the API.

      But unfortunately I couldn't find any solution to get the old expiry dates. Please help to sot out this problem.

      Thank you.

      M 1 Reply Last reply Reply Quote 0
      • M
        Moderator_3 @Mitrajit last edited by

        Hello @Mitrajit

        As of now we are not providing the historical data of expired contract but for live contracts you can use the quote(Market Data API) or GetLtpData API

        Regards,
        SmartAPI Team

        M 1 Reply Last reply Reply Quote 0
        • M
          Mitrajit @Moderator_3 last edited by

          @Moderator_3
          Thank you for your reply.

          Got your point. But then how some algo platforms backtesting their strategies and providing the P&L and other reports? Is their any other way to do it? Please suggest. I'm completely new in this.

          Thank you.

          M 1 Reply Last reply Reply Quote 0
          • M
            Moderator_1 @Mitrajit last edited by

            Hello @Mitrajit,
            NSE website has day-wise price volume data for expired options contracts. It can be accessed here

            Regards
            SmartAPI Team

            1 Reply Last reply Reply Quote 0
            • First post
              Last post