question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Every two minute i got this error - Connection error: 1006 - connection was closed uncleanly (None)

See original GitHub issue

I 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)

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
vijaykzcommented, Aug 15, 2020
push_tick_values_to_trd_portfolio(tick, ticks_token)
push_value_to_excel()

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.

0reactions
vijaykzcommented, Apr 30, 2021

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]

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found