Navigation

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

    Historical data api not working

    Python SDK
    2
    11
    15
    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.
    • A
      algo_trading_50 @asif_khan1993 last edited by

      @asif_khan1993 Try example code here.

      A 1 Reply Last reply Reply Quote 0
      • A
        asif_khan1993 @algo_trading_50 last edited by

        @algo_trading_50 I tried with this example only but getting
        Error occurred while making a POST request to https://apiconnect.angelone.in/rest/secure/angelbroking/historical/v1/getCandleData. Error: Invalid API Key

        A 1 Reply Last reply Reply Quote 0
        • A
          algo_trading_50 @asif_khan1993 last edited by

          @asif_khan1993 Try creating an API app from here.

          A 1 Reply Last reply Reply Quote 0
          • A
            asif_khan1993 @algo_trading_50 last edited by

            @algo_trading_50 I have already created the app, named asif_api,

            A 1 Reply Last reply Reply Quote 0
            • A
              algo_trading_50 @asif_khan1993 last edited by

              @asif_khan1993

              from SmartApi import SmartConnect
              
              API_KEY = 'API_KEY'
              JWT_TOKEN = 'JWT_TOKEN'
              
              obj = SmartConnect(access_token=JWT_TOKEN, api_key=API_KEY)
              
              historicParam = {
                  "exchange": "NSE",
                  "symboltoken": "1594",
                  "interval": "ONE_MINUTE",
                  "fromdate": "2026-03-19 09:00",
                  "todate": "2026-03-19 09:16"
              }
              
              candles = obj.getCandleData(historicParam)
              
              print(candles)
              
              A 1 Reply Last reply Reply Quote 0
              • A
                asif_khan1993 last edited by

                @algo_trading_50 I am getting the same error
                [E 260324 13:26:08 smartConnect:246] Error occurred while making a POST request to https://apiconnect.angelone.in/rest/secure/angelbroking/historical/v1/getCandleData. Error: Invalid Token. URL:

                1 Reply Last reply Reply Quote 0
                • A
                  asif_khan1993 @algo_trading_50 last edited by

                  @algo_trading_50 I have created api type as trading api, how to create another app with type histocical api ?? I am not able to

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    algo_trading_50 @asif_khan1993 last edited by

                    @asif_khan1993 Kindly use "New Login".

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      asif_khan1993 @algo_trading_50 last edited by

                      @algo_trading_50 I am using new login only...

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        algo_trading_50 @asif_khan1993 last edited by

                        @asif_khan1993 You are right, with "New Login" API app it is giving following error:

                        {'success': False, 'message': 'Invalid API Key', 'errorCode': 'AG8004', 'data': ''}
                        

                        With old API app created using "Login" page seems to be working fine.

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