Not getting data from websockets streaming request

geezvimal
Hi,
My kiteconnect is working fine and able to make orders.
Got the public token as well.

I am trying to make the request from AWS instance. No certificate installed.

Curl check:

curl https://websocket.kite.trade/?api_key=XXXX&user_id=XXXX&public_token=XXXX

Response: Missing api_key, user_id or public_token parameter
'user_id' is not recognized as an internal or external command,
operable program or batch file.
'public_token' is not recognized as an internal or external command,
operable program or batch file.


I have read through the forum discussion and tried all the options and still not getting the data feed. Below copy pasted the script that I a

#!python

from kiteconnect import KiteConnect
from kiteconnect import WebSocket

import logging
logging.basicConfig(level=logging.DEBUG)

api_key= 'XXXX'
public_token='XXXX'
user_id='XXXX'
access_token='XXXX'

kite = KiteConnect(api_key=api_key)
# Initialise. api_key, public_token, user_id are correct just as obtained.
kws = WebSocket(api_key, public_token, user_id)

# Callback for tick reception.
def on_tick(tick, ws):
logging.debug(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])

#Reconnection command added by me as a backup measure.
def on_close(ws):
logging.debug("closed connection")
ws.reconnect()

# 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()


Sign In or Register to comment.