Navigation

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

    how to get token on nifty option to trade it

    General Discussion
    0
    3
    7
    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.
    • T
      Tanay1907 last edited by

      is there any endpoint for option chain or is there any way to get token to trade in options.

      B 1 Reply Last reply Reply Quote 0
      • B
        basuvijay @Tanay1907 last edited by

        @Tanay1907 You can use below code to get token if you are using python

        def get_symbol_token(trading_symbol, exchange="NFO"):
            url = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/searchScrip"
            payload = {"exchange": exchange, "searchscrip": trading_symbol}
            response = requests.post(url, json=payload, headers=headers)
            #print(response.text)
            data = response.json()
            
            if data.get("status") and "data" in data and len(data["data"]) > 0:
                return data["data"][0]["symboltoken"]
            print(f"[❌] Symbol token not found for {trading_symbol}")
            return None
        

        in trading_symbol you need pass strike like below
        BANKNIFTY27FEB2548300PE

        1 Reply Last reply Reply Quote 0
        • A
          admin last edited by

          @Tanay1907 please use instrument master data.

          https://margincalculator.angelone.in/OpenAPI_File/files/OpenAPIScripMaster.json
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post