Every two minute i got this error - Connection error: 1006 - connection was closed uncleanly (None)
See original GitHub issueI read previous discussions about this error but am not resolve this issue am also not using any computation inside on_ticks(). kindly help me
susbcription_list = [int(x) for x in trd_portfolio]
def getticks(ticks):
for tick in ticks:
ticks_token = tick['instrument_token']
push_tick_values_to_trd_portfolio(tick, ticks_token)
push_value_to_excel()
def on_ticks(ws, ticks):
# Todo: "On_ticks"
getticks(ticks)
def on_connect(ws, response):
ws.subscribe(susbcription_list)
ws.set_mode(ws.MODE_FULL, susbcription_list)
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect(threaded=True)
count = 0
while True:
count += 1
if count % 2 == 0:
if kws.is_connected():
kws.set_mode(kws.MODE_FULL, susbcription_list)
else:
if kws.is_connected():
kws.set_mode(kws.MODE_FULL, susbcription_list)
time.sleep(5)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
1006 - connection was closed uncleanly (None)
I have been trying the github example of websocket usage in python since ... Connection error: 1006 - connection was closed uncleanly (None)....
Read more >Zerodha KiteConnect API producing 1006 Error - Stack Overflow
I was getting the same error while using KiteConnect WebSocket, So the issue in the tokens list - so first you have to...
Read more >Websoket keeps disconnecting. | SmartAPI Forum
admin I got the following error multiple times while running my algo using ... Connection closed: 1006 - connection was closed uncleanly (None)....
Read more >Websocket closes unexpectedly with error 1006
I am having issues with futures websocket where I randomly get 1006 error. ... connection is cut in this case I have noticed...
Read more >Connection error: 1006 - connection was closed uncleanly
Hi, I am new to algo,after placing the order to zerodha kiteconnect I am getting the below error frequently every 5sec. “Connection error: ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
By looks, these seem to be time consuming operations. Try doing only in-memory operations in
on_ticks()
and offload other functionalities to a separate thread.I do not have a need to save in DB. I create candlesticks in a list of lists like this:
ticks = [ [Date, O, H, L, C, V], [Date, O, H, L, C, V], .... [Date, O, H, L, C, V] ]
In order to perform operations on the latest bar, you can fetch it just by using
ticks[-1]