Navigation

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

    bm0126782

    @bm0126782

    2
    Reputation
    13
    Posts
    7
    Profile views
    0
    Followers
    3
    Following
    Joined Last Online

    bm0126782 Follow

    Best posts made by bm0126782

    • Authentication error

      Define the API endpoints

      login_url = 'https://smartapi.angelbroking.com/rest/auth/login'
      market_data_url = 'https://smartapi.angelbroking.com/rest/secure/angelbroking/currentdayextremes'

      Prepare the request headers for authentication

      headers = {
      'Content-Type': 'application/x-www-form-urlencoded',
      }

      Prepare the request data for authentication

      data = {
      'api_key': api_key,
      'password': api_secret,
      }

      Authenticate and obtain an access token

      response = requests.post(login_url, data=data, headers=headers)
      if response.status_code == 200:
      access_token = response.json()['data']['accessToken']

      # Prepare headers for fetching market data with the access token
      headers = {
          'Authorization': f'Bearer {access_token}',
          'Content-Type': 'application/json',
      }
      
      # Fetch today's Bank Nifty price
      response = requests.get(market_data_url, headers=headers)
      
      if response.status_code == 200:
          try:
              market_data = response.json()
              today_banknifty_price = market_data['data']['CASH']['BANKNIFTY']
              print(f"Today's Bank Nifty Price: {today_banknifty_price}")
          except json.JSONDecodeError:
              print("Error: Unable to decode JSON response.")
      else:
          print(f"Error fetching market data: {response.status_code} - {response.text}")
      

      else:
      print(f"Authentication error: {response.status_code} - {response.text}")

      kindly please guide where I am doing mistake.

      posted in Python SDK
      B
      bm0126782

    Latest posts made by bm0126782

    • RE: Individual order status API throws error for unknown reason!

      @projectSB But how to get the "uniqueOrderID" as once you placed order, you usually get the order id not uniqueOrderID. can you please share some light.
      @Moderator_2 , @projectSB

      posted in Python SDK
      B
      bm0126782
    • RE: Connection Error while login.

      @Phanilbb same with me.

      ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

      Don't know what happen.
      @admin123

      posted in Bugs
      B
      bm0126782
    • Data API can support

      Hello,

      What are different data we can fetch though this API.
      More in detail : does this API share given Stock fundamentals as well?

      posted in General Discussion
      B
      bm0126782
    • RE: List of all Smartapi functions in Python

      @Mnagesh Thank you very much.!!

      posted in Python SDK
      B
      bm0126782
    • RE: What is limit of Max retries to access /historical/v1/getCandleData

      ConnectTimeout: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/historical/v1/getCandleData (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002CA7F4AA010>, 'Connection to apiconnect.angelbroking.com timed out. (connect timeout=7)'))

      Can some one please help me here...
      Thanks in advance
      @admin @admin123

      posted in Python SDK
      B
      bm0126782
    • RE: Authentication error

      @C50781558 I don't have algo software in my company.
      what you are interested to tell?

      posted in Python SDK
      B
      bm0126782
    • RE: Authentication error

      @Moderator_1 thanks you. Problem solved.

      posted in Python SDK
      B
      bm0126782
    • What is limit of Max retries to access /historical/v1/getCandleData

      ConnectionError: HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Max retries exceeded with url: /rest/secure/angelbroking/historical/v1/getCandleData (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000023708D9FB90>: Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions'))

      What is limit of Max retries with url: /rest/secure/angelbroking/historical/v1/getCandleData ?
      @admin @admin123 @administrators

      posted in Python SDK
      B
      bm0126782
    • RE: Authentication error

      As per the github documentation, these are the deatils need to define.
      I knew about the api_key ,clientId , pwd

      api_key = 'Your Api Key'
      clientId = 'Your Client Id'
      pwd = 'Your Pin'
      smartApi = SmartConnect(api_key)
      token = "Your QR code value"
      totp=pyotp.TOTP(token).now()
      correlation_id = "abc123"

      from where I will get the token , correlation_id ?

      @admin123 @admin @MNAGESH
      Can you please help me here, I am starting over this API.

      posted in Python SDK
      B
      bm0126782
    • RE: Authentication error

      @admin123 @admin kindly please help

      posted in Python SDK
      B
      bm0126782