Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. sanjay09
    3. Posts
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Groups 0

    Posts made by sanjay09

    • Not able to get gainersLosers, PutCallRatio & OIBuildup

      Hi Team,
      Based on info available here i tried to integrate following API but i'm not getting any result.
      https://smartapi.angelone.in/docs/TopGainers

      APIS:
      https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/putCallRatio
      https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/gainersLosers
      https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/OIBuildup

      Example:

      --------------------------------------------------------------

      # TOP GAINERS / LOSERS
      # --------------------------------------------------------------
      def get_top_gainers_losers(self):
      
          api = self.get_api()
      
          try:
      
              payload = {
                  "exchange": "NSE"
              }
      
              resp = api._postRequest(
                  "marketData/v1/gainersLosers",
                  payload
              )
      
              if not resp:
                  return {"gainers": [], "losers": []}
      
              if not resp.get("status"):
                  logger.warning(f"Gainers/Losers fetch failed: {resp}")
                  return {"gainers": [], "losers": []}
      
              data = resp.get("data", {})
      
              return {
                  "gainers": data.get("gainers", []),
                  "losers": data.get("losers", [])
              }
      
          except Exception as e:
              logger.error(f"Gainers/Losers API error: {e}")
              return {"gainers": [], "losers": []}
      

      While testing :
      c = SmartAPIClient()
      c.login()
      movers = c.get_top_gainers_losers()

      print("Top Gainers:")
      for g in movers["gainers"][:5]:
          print(g)
      
      print("\nTop Losers:")
      for l in movers["losers"][:5]:
          print(l)
      

      Getting this output.
      [2026-03-16 10:13:33,230] [INFO] main: Logging into SmartAPI...
      [I 260316 10:13:33 smartConnect:124] in pool
      [2026-03-16 10:13:33,683] [INFO] main: ✔ SmartAPI Login Successful
      [2026-03-16 10:13:33,684] [ERROR] main: Gainers/Losers API error: 'marketData/v1/gainersLosers'
      Top Gainers:

      Top Losers:

      Process finished with exit code 0

      Facing same issue with other API's as well.

      Note: I'm testing this from my local machine, where other apis are working fine but not able to get these info always both in offline market and live market

      Any help with working ways how to get the result will be helpful specially Put Call Ratio is needed.

      posted in Python SDK
      S
      sanjay09
    • RE: Discrepancy Between Real-Time and Historical Market Data: Causes and Impact on Algo Trading Decisions

      Please my migrate my client id PADG1001

      posted in General Discussion
      S
      sanjay09