Navigation

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

    Posts made by namit

    • RE: Unable to unsubscribe the symbol in WebSocket and close the connection

      @Moderator_2 Have you analysed it yet?

      posted in Python SDK
      N
      namit
    • RE: Explore the Smart API WebSocket 2.0 User Guide (Depth 20) - Beta Testing

      @dev11 Hi, try removing 999 from each index and then fetch the data

      posted in General Discussion
      N
      namit
    • Unable to unsubscribe the symbol in WebSocket and close the connection

      Hi I am unable to unsubscribe the symbol when i don't need it. Even after unsubscribing it using sws.unsubscribe(correlation_id, mode, token_list) and trying to close the connection using sws.close_connection(), it doesn't close the connection but the symbol gets re-subscribe.
      What is the issue?

      for more details sharing the code.

      global correlation_id, mode, sws

          AUTH_TOKEN = credential.range('b8').value
          angelapikey = credential.range('b4').value
          feed_token = credential.range('b7').value
          client_code = credential.range('b2').value
          correlation_id = "option_live_data"
          action = 1
          mode = 1
          sws = SmartWebSocketV2(AUTH_TOKEN, angelapikey, client_code, feed_token)
      
          token_list = [{"exchangeType": 1, "tokens": [token_Nifty,token_Bank,token_Fin,token_Mid]}]
          
          token_Nifty = "26000"
          token_Bank = "26009"
          token_Fin = "26037"
          token_Mid = "26074" 
          def on_data(wsapp, message):
              # print("Ticks: {}".format(message))
              
              token = message['token']
              last_price = message['last_traded_price']
              last_price = last_price/100
              print(last_price)
      
      
          def on_open(wsapp):
              print("\n------Options Live LTP subscribed------")
              sws.subscribe(correlation_id, mode, token_list)
      
      
          def on_error(wsapp, error):
              print(error)
      
      
          def on_close(wsapp):
              print("Close")
      
          sws.on_open = on_open
          sws.on_data = on_data
          sws.on_error = on_error
          sws.on_close = on_close
      
          threading.Thread(target = sws.connect).start()
      
      def ws_disconnect():
          print("\n------ Unsubscribed Options ------")
          sws.unsubscribe(correlation_id, mode, token_list)
          sws.close_connection()
      
      posted in Python SDK
      N
      namit
    • RE: SEBI circular on algo trading and it's impact

      @softice Can pls share the link of that circular so others can also read it.

      posted in General Discussion
      N
      namit
    • RE: How to fetch live data for indices using websockets

      @sevrus
      from smartWebSocketV2 import SmartWebSocketV2

      For Live NIFTY, BANKNIFTY LTP

         AUTH_TOKEN = 
         angelapikey = 
         feed_token = 
         client_code = 
         correlation_id = "live_data"
         action = 1
         mode = 1
         sws = SmartWebSocketV2(AUTH_TOKEN, angelapikey, client_code, feed_token)
      
         token_Nifty = "26000"
         token_Bank = "26009"
         token_Fin = "26037"
         token_Mid = "26074"
      
         token_list = [{"exchangeType": 1, "tokens": [token_Nifty,token_Bank,token_Fin,token_Mid]}]
      
         def on_data(wsapp, message):
           # print("Ticks: {}".format(message))
           token = message['token']
           last_price = message['last_traded_price']
           last_price = last_price/100
             
          def on_open(wsapp):
              print("\n------Options Live LTP subscribed------")
              sws.subscribe(correlation_id, mode, token_list)
      
      
          def on_error(wsapp, error):
              print(error)
      
      
          def on_close(wsapp):
              print("Close")
      
          sws.on_open = on_open
          sws.on_data = on_data
          sws.on_error = on_error
          sws.on_close = on_close
      
          threading.Thread(target = sws.connect).start()
      

      "" Do check the indent correctly ""

      posted in Python SDK
      N
      namit
    • RE: Connection problem with websocket2.0

      @Moderator_2 Hi this issue is not about having more than three connections. This issue comes even with only one connection with only one token subscribed. And this happens lot of time.
      Not only that, even if you unsubscribe the token using sws.unsubscribe(correlation_id, mode, token_list) and sws.close_connection(), it doesn't close and gets resubscribed.

      posted in Python SDK
      N
      namit
    • RE: How do I get historical Index Data for NIFTY/SENSEX?

      @admin Hello admin, why angel is not offering the index historical data? For options trading specifically for Nifty and Banknifty, their historical data is very very important for algo traders. However you are providing the future data of index then why not of the index directly?

      posted in General Discussion
      N
      namit
    • 'Ping_payload' error

      Re: Getting error in websocketV2
      File "C:\Users\Namit\OneDrive\Desktop\Option_Chain\Angel\smartWebSocketV2.py", line 264, in connect
      self.wsapp.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}, ping_interval=self.HEAR_BEAT_INTERVAL,
      TypeError: run_forever() got an unexpected keyword argument 'ping_payload'

      Why this is happening?

      posted in Python SDK
      N
      namit
    • RE: what is AMX Error - AB1007

      @SSumit said in what is AMX Error - AB1007:

      @admin what is AMX Error - AB1007. I am getting this error for rms limit API only.

      @admin i'm also getting this error .. don't know if admin would ever reply to this.

      posted in General Discussion
      N
      namit
    • Max Retries Error !! again and again

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

      This is coming again and again. With this my whole algo trading logic gets destroyed as i am not able to execute trade.

      What is the use of SmartApi if the connection time out is happening again and again.

      @Admin should we stop using SmartApi and move to another broker?

      posted in Bugs
      N
      namit
    • RE: "Order placement failed: 'NoneType' object is not subscriptable"

      @neeluru
      is it working for options as well ? because i'm seeing this error only when i'm trying to place order for option {nifty, banknifty).

      What i came to know that this is generating from the file smartConnect.py at line 290 which basically i don't understand. May be you can figure it out.
      Let me know !!

      posted in Python SDK
      N
      namit
    • RE: "Order placement failed: 'NoneType' object is not subscriptable"

      Hello @admin
      so here is some more info which i get while placing the order.
      Basically this error is only coming while i'm trying to place order for options. For equity no error like this is coming.
      Also i m getting the following details while placing order which seems to be in your api code..

      File "C:\Python311\Lib\site-packages\smartapi\smartConnect.py", line 290, in placeOrder
      orderResponse= self._postRequest("api.order.place", params)['data']['orderid']
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
      TypeError: 'NoneType' object is not subscriptable

      So you may like to look at line no. 290 in your samrtConnect.py file for more info why this error is getting generated. Looking forward for your reply.
      Thanks

      posted in Python SDK
      N
      namit