Web socket scripts stop at random times
-
@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.
-
Hi @rjbanna We have already reported the issue to the team we are trying to solve it asap.
-
-
@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.
-
Agreed.. its pretty hard. Hope this gets resolved soon.
-
@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.
-
@rjbanna, Still am not very sure on it... If its not too much trouble, shall we connect privately ?
-
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.
-
@admin I'm also testing the new SDK, no issues till now. Thanks for quick issue resolution.
-
-
Pease note new SDK needs changes to the script. You need to add
ws.websocket_connection()
to on_connectfrom 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( )
-
@rajanprabu Noted Rajan.. bhavesh informed me about that...
-
@admin Today also I got heartbeat failed message.
-
@rjbanna Same here.
-
-
@rajanprabu Yes
-
@admin , Any update on this? Facing exact same issues still. ws is not reliable at all.
-
-
Hi @Ashok can you post the snip here.
-
{'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:11.170880'}
{'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:11.171432'}
{'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:11.171963'}
{'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:11.172687'}
[2021/03/30 13:59:11] HeartBeats Failed
[2021/03/30 13:59:11] HeartBeats Failed
[2021/03/30 13:59:12] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
[2021/03/30 13:59:12] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
[2021/03/30 13:59:12] HeartBeats Failed
[2021/03/30 13:59:12] HeartBeats Failed
[2021/03/30 13:59:13] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
[2021/03/30 13:59:13] HeartBeats Failed
[2021/03/30 13:59:13] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
[2021/03/30 13:59:13] <function on_connect at 0x7ff5b750d5e0>
{'task': 'cn', 'channel': '', 'token': '0921225492', 'user': 'REHR1010', 'acctid': 'REHR1010'}
{'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:13.286596'}
{'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:13.287143'}
[2021/03/30 13:59:13] HeartBeats Failed
[2021/03/30 13:59:13] HeartBeats Failed
[2021/03/30 13:59:13] HeartBeats Failed
[2021/03/30 13:59:14] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
[2021/03/30 13:59:14] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
[2021/03/30 13:59:14] HeartBeats Failed
[2021/03/30 13:59:14] HeartBeats Failed
[2021/03/30 13:59:14] HeartBeats Failed
[2021/03/30 13:59:14] HeartBeats Failed
[2021/03/30 13:59:14] <function on_connect at 0x7ff5b750d5e0>
{'task': 'cn', 'channel': '', 'token': '0921225492', 'user': 'REHR1010', 'acctid': 'REHR1010'}
{'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:15.025724'}
{'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:15.026091'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
[2021/03/30 13:59:15] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
[2021/03/30 13:59:15] HeartBeats Failed
[2021/03/30 13:59:15] HeartBeats Failed
[2021/03/30 13:59:15] HeartBeats Failed
[2021/03/30 13:59:15] HeartBeats Failed
[2021/03/30 13:59:15] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
[2021/03/30 13:59:16] HeartBeats Failed
[2021/03/30 13:59:16] HeartBeats Failed
[2021/03/30 13:59:16] HeartBeats Failed
[2021/03/30 13:59:16] HeartBeats Failed
[2021/03/30 13:59:16] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
{'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
{'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:17] HeartBeats Failed
[2021/03/30 13:59:18] HeartBeats Failed