Navigation

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

    Unpredictable Invalid Token response from historical API

    Python SDK
    4
    12
    117
    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
      admin @pranav last edited by

      Hi @pranav we will check and revert you back.

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

        Hi @pranav As we tried to hit historical data API multiple times We are able to easily get the data. Please try to restart the kernel and try to run the code again.

        P 1 Reply Last reply Reply Quote 0
        • P
          pranav @admin last edited by

          @admin Still having the same issue. I'll try in a cloud server now. May be, it will work fine there. But what about the structure of data I'm getting in response. It's hard to understand. Can you share a code* snippet for converting it to some useful format (like pandas data frame or json with key value pairs) as right now I'm unable to figure out what value is what. Eg. in
          2021-03-02T00:00:00+05:30,1120.80,1333.95,1099.20,1202.95,1147120\n
          it would be better if it was mentioned like
          {
          time_modified: '02T00:00:00+05:30',
          open: 1120.80,
          high: 1333.95,
          ...
          }

          • sorry if I'm asking for too much😓
          J 1 Reply Last reply Reply Quote 0
          • J
            jiwan1986 @pranav last edited by

            @pranav Currently the response is in a string format. They are working on to return JSON data. So it would be easy to parse.

            P 1 Reply Last reply Reply Quote 0
            • P
              pranav @jiwan1986 last edited by

              @rjbanna All right , when can I expect it to be done? I actually need it for a project. if I somehow parse the current format but it stops working in future.

              @admin can you give a tentative time period?

              J A 2 Replies Last reply Reply Quote 0
              • J
                jiwan1986 @pranav last edited by

                @pranav I don't have any timeline. You can ask @admin

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

                  Hi @pranav we can expect it to be ready after 3 to 4 working days.

                  P 2 Replies Last reply Reply Quote 0
                  • P
                    pranav @admin last edited by

                    @admin great👍

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      Surya 1 @pranav last edited by

                      @pranav

                      You dont have to wait.. you can do it yourself until team implements it.. use the snippet below.. you will get a data frame.. there must be other easier ways to do it.. I just write it quickly for you. If you want json you convert it before df or simply df.to_json()

                      import pandas as pd
                      
                      params = { 
                      "exchange": "NSE", 
                      "symboltoken": "3045", 
                      "interval": "ONE_MINUTE", 
                       "fromdate": "2021-02-08 09:15", 
                       "todate": "2021-02-08 09:45" 
                      }                                                                                                                                                                                    
                      resp =  angel_api.getCandleData(params) 
                      
                      df = pd.DataFrame(resp['data'].split('\n'), columns=["data"]) 
                      x =  [x.split(',') for x in df['data'].values.tolist()] 
                      columns = ['Timestamp', 'open', 'high', 'low', 'close', 'volume']
                      df  = pd.DataFrame(x, columns= columns)  
                      

                      Hope this helps.

                      1 Reply Last reply Reply Quote 0
                      • P
                        pranav @admin last edited by

                        @admin any updates on this?

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

                          Hi @pranav we will update you on this.

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