Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. kalanithi
    K
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    kalanithi

    @kalanithi

    0
    Reputation
    1
    Posts
    1
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    kalanithi Follow

    Best posts made by kalanithi

    This user hasn't posted anything yet.

    Latest posts made by kalanithi

    • RE: Announcing Top Gainers/ Losers, PCR and OI BuildUp APIs for SmartAPI Users

      @Moderator_1 Hi Team, I am also getting the same error.

      Response: {'success': False, 'message': 'Invalid API Key', 'errorCode': 'AG8004', 'data': ''}.
      Below is the code I tried. Could you please help

      import requests

      Define the API endpoint

      url = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/marketData/v1/gainersLosers"

      Define the headers (replace with actual values as required)

      headers = {
      "Authorization": "Bearer eyJhbGciOiJIUzxxxxxxx", #token
      "Content-Type": "application/json",
      "Accept": "application/json"
      }

      Define the request packet

      payload = {
      "datatype": "PercPriceGainers", # datatype
      "expirytype": "NEAR" # expiry type
      }

      Send the POST request

      response = requests.post(url, headers=headers, json=payload)

      Check the response

      if response.status_code == 200:
      print("Request Successful")
      print("Response:", response.json())
      else:
      print(f"Request Failed with status code {response.status_code}")
      print("Response:", response.text)

      posted in General Discussion
      K
      kalanithi