hi, I have gone through some of above subjected issues but unable to fix. You are saying that need to kill the access_token using invalid_access_token however it also wont work.
but access token is working very well in kiteconnect and i am able to download instruments. but same access_token is not working i guess.
Below is my code which is given by you one of the solution in the forum.
def on_connect(ws, response): # noqa # Callback on successful connect. # 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])
The instruments master filed doesn't check for authentication. Hence you are able to fetch data without valid access token as well. If you are getting 403 then you need to generate a new access token.
Sujith, i am able to dump the instruments using the same access_token in KiteConnect. But, it is not working in KiteTicker. I regenerated and was used, even though it is not working.
Thanks Sujith, it is connecting now however i have not properly closed the websocket therefore, i am getting below error in my next connection today, how to solve this.
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
def on_connect(ws, response): # noqa # Callback on successful connect. # 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])
Yes I have created and I can able to get my order and profile details using same api_key or access_token. I am using Jupyter for testing, also run python code.
If you are getting 403 then you need to generate a new access token.
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
i am able to dump the instruments using the same access_token in KiteConnect. But, it is not working in KiteTicker. I regenerated and was used, even though it is not working.
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
import logging
from kiteconnect import KiteTicker
logging.basicConfig(level=logging.DEBUG)
# Initialise
kws = KiteTicker("your_api_key", "your_access_token")
def on_ticks(ws, ticks): # noqa
# Callback to receive ticks.
logging.info("Ticks: {}".format(ticks))
def on_connect(ws, response): # noqa
# Callback on successful connect.
# 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])
def on_order_update(ws, data):
logging.debug("Order update : {}".format(data))
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_order_update = on_order_update
# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
data = kite.generate_session("XXXXX", secret)
print(data)