It looks like you're new here. If you want to get involved, click one of these buttons!
pip install kiteconnect --upgrade --pre
However, I get the following errors:
#!/usr/bin/env python
import logging
from kiteconnect import KiteConnect
from kiteconnect import KiteTicker
logging.basicConfig(level=logging.DEBUG)
api_key = 'XXXXXXXXXXXXXX'
kite = KiteConnect(api_key=api_key)
# login
login_url = kite.login_url()
print(login_url)
# ...log in from the webbrowser and...
public_token = input('2. Now enter the public token: ')
# replace with actual user id
user_id = 'XY1234'
kws = KiteTicker(
api_key,
public_token,
user_id,
)
# Ticks callback
def on_ticks(ws, ticks):
# Callback for tick reception.
print(ticks)
# Connect callback
def on_connect(ws, response):
# Callback for successful connection.
# Subscribe to a list of instrument_tokens
# (RELIANCE:BSE and INFOSYS:BSE here).
tokens = [
153683204,
153653508,
]
ws.subscribe(tokens)
# Set all symbols to tick in `full` mode.
ws.set_mode(ws.MODE_FULL, tokens)
print('Connected!')
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect()
A similar script for the older version of pykiteconnect used to work. What could be the problem here?
ERROR:kiteconnect.ticker:WebSocket connection lost: [Failure instance: Traceback (failure with no frames): : Connection was aborted locally, using.
].
ERROR:kiteconnect.ticker:WebSocket connection lost: [Failure instance: Traceback (failure with no frames): : Connection was aborted locally, using.
].
ERROR:kiteconnect.ticker:Try reconnecting. Retry attempt count: 1
ERROR:kiteconnect.ticker:WebSocket connection lost: [Failure instance: Traceback (failure with no frames): : Connection was aborted locally, using.
].
ERROR:kiteconnect.ticker:Try reconnecting. Retry attempt count: 2
kws = KiteTicker(api_key="api_key", access_token="access_token")