I have my access_token and api_key and using it to send mkt orders but while I try to fetch the tick data using KiteTicker API I get 1006 connection error (Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake). Could you please help understand why is this happening?
Sample code below:
from kiteconnect import KiteConnect from kiteconnect import KiteTicker
def on_ticks(ws, ticks): # Callback to receive ticks. print(ticks) print("\n")
def on_connect(ws, response): # Callback on successful connect. # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe()
# Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_FULL, )
def on_close(ws, code, reason): # On connection close stop the event loop. # Reconnection will not happen after executing `ws.stop()` ws.stop()