# Callback for tick reception. def on_tick(tick, ws): print tick
# Callback for successful connection. def on_connect(ws): # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe([738561, 5633])
# Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_FULL, [738561])
# Assign the callbacks. kws.on_tick = on_tick kws.on_connect = on_connect
# Infinite loop on the main thread. Nothing after this will run. # You have to use the pre-defined callbacks to manage subscriptions. kws.connect()
I just get the following output:
and the program exits.
There is no infinite loop as mentioned in the documentation.
this is what pip freeze looks like(in a virtualenv): backports.ssl-match-hostname==3.5.0.1 kiteconnect==3.2 pymongo==3.3.0 requests==2.11.1 six==1.10.0 websocket-client==0.37.0
@mightymosquito 'ws' (insecure) is just a test endpoint and will be deprecated in the near future. if wss (secure / https) isn't working, there must be some issue with the root certificates on your system, which you should try and resolve.
this is what pip freeze looks like(in a virtualenv):
backports.ssl-match-hostname==3.5.0.1
kiteconnect==3.2
pymongo==3.3.0
requests==2.11.1
six==1.10.0
websocket-client==0.37.0
Working fine with ws://websocket.kite.trade/