I am not getting what is that public token which I need to pass as an argument while initialising? Is it same as request token? If no, can anybody please explain me how can I get public token?
Thanks kailash. can you please let me know what is the symbol I should use for nifty cash? I am trying to fetch quotes of nifty cash. I used 'NIFTY' and 'NIFTY50' its not working.
@Kailash@vivek To start with, I just modified the example code that is given in documentation like below and tried to run the code. This code didn't receive back any ticks. Can you please have a look at the code. Please correct me if I my code is wrong .
from kiteconnect import WebSocket
kws = WebSocket(api_key, public_token, kite_uid) # I changed only this line
# 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()
Please look at the response attributes.
from kiteconnect import WebSocket
kws = WebSocket(api_key, public_token, kite_uid) # I changed only this line
# 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()