Navigation

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

    Posts made by SKExplorer

    • RE: Websocket Error - Attempting to resubscribe/reconnect

      @ngk Hello, I also faced the problem suddenly....and what I found was a silly post processing routine execution error(bug)....but the websocket client thinks is somehting to do with "subsciption /unsubscription"...thats all..

      CHECK the following in your code...

      1. can you print the received tick as it is ? ...the printed data should tell you if there is an error ...if printed data shows buy/sell or ltp etc..you have no connection/subsciption problems....

      2. are you calling any function or processing (ie, doing any thing to received data for the strategy...)the received data ?

        if yes, thoroughly check that code...any error in that code will cause an error for websocket client and cause it to fire its on_error...which is "Attempting...."...but the actual error was an execution error in the post processing function/routine....

      Hope it helps...

      posted in Python SDK
      S
      SKExplorer
    • RE: Market Data API-Quote

      @Moderator_2 Hi, I was trying out WebSocket2 as suggested.
      I was successful in the first few attempts to and received ticks...
      but now I get "Attempting to resubscribe/reconnect (Attempt 1)..." and then I get "Connection closed due to max retry attempts reached." consistently.

      I logged out, rebooted the machine but still gets the same error.

      Code sample I am using is the websocket2 example from github.

      posted in Python SDK
      S
      SKExplorer
    • RE: Exception while retriving IP Address

      @baahu_chanduwad Dont know if you have resolved this...just in case,
      SmartConnect.py tries to connect to api.ipfy.org to get the the client PublicAPI...there is no url named api.ipfy.org...IT SHOULD BE api64.ipfy.org

      posted in Test
      S
      SKExplorer
    • RE: Historical API returns error 400!!!! - Python

      @Moderator_2 I have tried smartApi.getCandleData, I get the same http 400 error....http response has no error message either to debug!!!!

      Is there something additional to be added to the HEADER data for Historical API ? I am successfully sing the same header to retrieve quote data.

      can you try my code and see whats wrong ?

      posted in Test
      S
      SKExplorer
    • RE: Historical API returns error 400!!!! - Python

      @Moderator_2 I am posting the code again.....

      http = urllib3.PoolManager()
      API_ENDPOINT = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData"

      #thirty_days_ago = datetime.now() - timedelta(days=30)
      #from_date = thirty_days_ago.strftime("%Y-%m-%d %H:%M")
      #to_date = datetime.now().strftime("%Y-%m-%d %H:%M")

      from_date = "2021-07-01 09:41"
      to_date = "2021-07-29 10:41"

      print(from_date)
      print(to_date)

      payload = { "exchange": "NSE",
      "symboltoken": "3045",
      "interval": "ONE_HOUR",
      "fromdate": from_date,
      "todate": to_date
      }

      encoded_data = json.dumps(payload).encode('utf-8')

      r = http.request('POST', API_ENDPOINT,
      headers=headers,

              body=encoded_data)
      

      print(r.status)
      print('DRAW:',r.data)

      resp_body = r.data.decode('utf-8')
      print(f'DATA:{resp_body}')

      posted in Test
      S
      SKExplorer
    • RE: Market Data API-Quote

      @Moderator_2 so basically, rephrasing my question again, you dont provide level 3 data ??? thank you.

      posted in Python SDK
      S
      SKExplorer
    • RE: Historical API returns error 400!!!! - Python

      @Moderator_2 below is the simple code that I am testing... I am trying off market hours not live...

      http = urllib3.PoolManager()
      API_ENDPOINT = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData"

      #thirty_days_ago = datetime.now() - timedelta(days=30)
      #from_date = thirty_days_ago.strftime("%Y-%m-%d %H:%M")
      #to_date = datetime.now().strftime("%Y-%m-%d %H:%M")

      from_date = "2021-07-01 09:41"
      to_date = "2021-07-29 10:41"

      print(from_date)
      print(to_date)

      payload = { "exchange": "NSE",
      "symboltoken": "3045",
      "interval": "ONE_HOUR",
      "fromdate": from_date,
      "todate": to_date
      }

      encoded_data = json.dumps(payload).encode('utf-8')

      r = http.request('POST', API_ENDPOINT,
      headers=headers,

                  body=encoded_data)
      

      print(r.status)
      print('DRAW:',r.data)

      resp_body = r.data.decode('utf-8')
      print(f'DATA:{resp_body}')

      posted in Test
      S
      SKExplorer
    • RE: Market Data API-Quote

      @Moderator_2 my question was , does it give only best five ? not 20 ?

      posted in Python SDK
      S
      SKExplorer
    • Market Data API-Quote

      Does the quote API give only best 5 buy/sell quantities ???

      posted in Python SDK
      S
      SKExplorer
    • RE: Historical API returns error 400!!!! - Python

      @Moderator_2

      I am using python sdk for authentication..

      I have checked the code (for getting candle data again...(given in this post) ... It still returns http 404 error... can you see anything wrong with the code ???

      I am successfully using market data API...

      posted in Test
      S
      SKExplorer
    • Historical API returns error 400!!!! - Python

      Historical API keeps returning Http Status 400 even with the EXAMPLE GIVEN!!!!! why ?

      here is my code...

      http = urllib3.PoolManager()
      API_ENDPOINT = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData"
      
      #thirty_days_ago = datetime.now() - timedelta(days=30)
      #from_date = thirty_days_ago.strftime("%Y-%m-%d %H:%M")
      #to_date = datetime.now().strftime("%Y-%m-%d %H:%M")
      
      from_date = "2021-07-01 09:41"
      to_date = "2021-07-29 10:41"
      
      print(from_date)
      print(to_date)
      
      payload = { "exchange": "NSE",    
                  "symboltoken": "3045",
                   "interval": "ONE_HOUR",  
                  "fromdate": from_date,
                   "todate": to_date
                   }
      
      
      encoded_data = json.dumps(payload).encode('utf-8')
      
      r = http.request('POST', API_ENDPOINT,
                      headers=headers,
                      
                      body=encoded_data)
      
      print(r.status)
      print('DRAW:',r.data)
      resp_body = r.data.decode('utf-8')
      print(f'DATA:{resp_body}')
      
      posted in Test
      S
      SKExplorer