Navigation

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

    Persistent JSON Decode/No Data Error on GetOptionChain & GetExpiryDate

    Python SDK
    2
    2
    3
    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.
    • C
      chinmaya2495 last edited by

      Dear SmartAPI Team,

      I am experiencing severe and persistent API instability when attempting to fetch options data, particularly during live market hours (9:30 AM - 11:00 AM IST). The issue prevents my automated strategy from running.

      Client Code: C86719

      The core problem occurs with two key API calls:

      1. GET EXPIRY DATE (getOptionExpiryDate)

        • Endpoint: https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/getOptionExpiryDate
        • Failure Mode: This call frequently fails after market open. It returns a Status: 200 (Success), but the response body is empty or corrupted (non-JSON). This causes my Python script to fail with a json.JSONDecodeError (Expecting value: line 1 column 1).
      2. GET OPTION CHAIN (getOptionChain)

        • Failure Mode: If I bypass the expiry lookup by hardcoding the date, the getOptionChain call fails next.
        • Log: My bot logs "API unstable/Contracts not available for ATM [Strike]. Retrying..." This happens even for valid, liquid ATM strikes.

      My Application Logic (To Help You Replicate)

      My bot is a high-frequency intraday strategy that must run on the 5-MINUTE timeframe for options.

      1. On Start (9:30 AM): The bot's first task is to find the ATM Nifty strike and the nearest weekly expiry. To do this, it calls getOptionExpiryDate and getOptionChain. (This is where it fails with the errors above.)

      2. Main Loop (Every 30 seconds):

        • Once it has the CE and PE tokens, the bot enters a fast loop.
        • In this loop, it calls getCandleData for the 5-MINUTE interval on the specific option tokens (e.g., Token 51105) to check for an EMA crossover.
        • This secondary call to getCandleData (for NFO tokens) also frequently fails during the day, returning AB1004: Something Went Wrong.

      Impact: The instability of getOptionExpiryDate and getOptionChain during market open makes it impossible to automate the selection of option contracts. The subsequent instability of getCandleData for NFO tokens makes the strategy unreliable.

      Please investigate the server-side instability for these critical NFO data endpoints during active trading hours.

      Thank you.

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

        Hi @chinmaya2495

        Please let us know what actual error your facing also share with error screenshot

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