Navigation

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

    Web socket scripts stop at random times

    Python SDK
    5
    43
    249
    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.
    • J
      jiwan1986 @punit last edited by

      @Ashok No need to create object for logger. You can use my code. I'm using that code and I'm able to see all the exceptions including heartbeat failed.

      punit 1 Reply Last reply Reply Quote 0
      • J
        jiwan1986 @punit last edited by

        @Ashok I haven't encountered this issue yesterday, though sometimes heartbeat failed. I was receiving the ticks even though the heartbeats failed message kept coming. Socket was reconnected but heartbeat function was not aware about it. There is issue with heartbeat function which should be resolved as soon as possible. This is why it is important to place SL order right after the first order is placed. Because you don't know when something gets broken in future. @admin please look into this.

        A S 2 Replies Last reply Reply Quote 0
        • A
          admin @jiwan1986 last edited by

          Hi @rjbanna We have already reported the issue to the team we are trying to solve it asap.

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

            @rjbanna @Ashok

            Yes I faced it twice yesterday.. But whoever this happened I normally stopped the script and restarted it. I think angel team is working on it.

            J 1 Reply Last reply Reply Quote 0
            • J
              jiwan1986 @Surya 1 last edited by

              @rajanprabu Yes, I do the same but my algo make use of some past calculations and live candles. So if I start it again, I would need to calculate all the values manually which is cumbersome process. Angel team is working on it.

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

                @rjbanna

                Agreed.. its pretty hard. Hope this gets resolved soon.

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

                  @rajanprabu @rjbanna @Ashok we have tried to handle all this issues in the new version of python sdk.We will be testing it and reverting you back soon.

                  S J 3 Replies Last reply Reply Quote 0
                  • punit
                    punit @jiwan1986 last edited by admin

                    @rjbanna, Still am not very sure on it... If its not too much trouble, shall we connect privately ?

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

                      @admin

                      I have tested the new SDK.. so far it passed all my stress tests.. I will continue my testing and I will keep it posted. Thanks to the team. Very good job.

                      1 Reply Last reply Reply Quote 0
                      • J
                        jiwan1986 @admin last edited by

                        @admin I'm also testing the new SDK, no issues till now. Thanks for quick issue resolution.

                        1 Reply Last reply Reply Quote 0
                        • punit
                          punit last edited by

                          @admin @rjbanna Thanks. Moved to new SDK 1.2.3 now... Thanks for support

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

                            @Ashok

                            Pease note new SDK needs changes to the script. You need to add ws.websocket_connection() to on_connect

                            from smartapi import WebSocket 
                            FEED_TOKEN= "your feed token"
                            CLIENT_CODE="your client Id"
                            token="channel you want the information of" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
                            task="task" #"mw"|"sfi"|"dp"
                            ss = WebSocket(FEED_TOKEN, CLIENT_CODE)
                            
                            def on_tick(ws, tick):
                                print("Ticks: {}".format(tick))
                            
                            def on_connect(ws, response):
                                ws.websocket_connection() 
                                ws.send_request(token,task) 
                                
                            def on_close(ws, code, reason):
                                ws.stop()
                            
                            # Assign the callbacks.
                            ss.on_ticks = on_tick
                            ss.on_connect = on_connect
                            ss.on_close = on_close
                            
                            ss.connect( )
                            
                            punit 1 Reply Last reply Reply Quote 0
                            • punit
                              punit @Surya 1 last edited by punit

                              @rajanprabu Noted Rajan.. bhavesh informed me about that...

                              1 Reply Last reply Reply Quote 0
                              • J
                                jiwan1986 @admin last edited by

                                @admin Today also I got heartbeat failed message.

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

                                  @rjbanna Same here.

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

                                    @Ashok @rjbanna

                                    with new SDK on MCX ?

                                    J 1 Reply Last reply Reply Quote 0
                                    • J
                                      jiwan1986 @Surya 1 last edited by

                                      @rajanprabu Yes

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

                                        @admin , Any update on this? Facing exact same issues still. ws is not reliable at all.

                                        S A 2 Replies Last reply Reply Quote 0
                                        • S
                                          Surya 1 @punit last edited by

                                          @Ashok

                                          Im running from morning and I dint face any issue. @rjbanna what about you ?

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

                                            Hi @Ashok can you post the snip here.

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