How to perform operations on the data received from on_order_update

KesharDev
I saw this ,but have some questions: https://kite.trade/forum/discussion/7399/kiteconnect-ticker-connection-error-1006-connection-was-closed-uncleanly-none

I think I did not understood properly, how to do this. It will be really good, If someone can help. This is my code:


def on_ticks(ws, ticks):
# Callback to receive ticks.
print(ticks)

def on_connect(ws, response):
# Callback on successful connect.
# Subscribe to a list of instrument_tokens (RELIANCE and ACC here).
print("Connection started")

ws.subscribe([13635586])
# # Set RELIANCE to tick in `full` mode.
# ws.set_mode(ws.MODE_FULL, instrument_token)


def on_close(ws, code, reason):
# On connection close stop the main loop
# Reconnection will not happen after executing `ws.stop()`
print("Connected stopped")

# ws.stop()

def on_order_update(ws, data):
print("Okay got data")

# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_order_update = on_order_update


while True:
#Perform required data operation using tick data
def on_order_update(ws, ticks):
helper_method(ticks)

def helper_method(ticks):
print("Got tick, sleeping now")
time.sleep(5)
print("Slept")
#Assign callback
kws.on_order_update=on_order_update

But I am getting this error:
Connection error: 1006 - connection was closed uncleanly (None)
Connection closed: 1006 - connection was closed uncleanly (None)
Sign In or Register to comment.