Error in subscribing list of tokens

chimirala
Hi Team,

I am trying to subscribe good FnO instruments by passing a list variable instead of a list directly.

#list of all FnO token (length is around 150)
ins_token=[1,2,3,4,5,....150]

#Using this list in function receiving the error
def on_connect(ws):
ws.subscribe(ins_token)
ws.set_mode(ws.MODE_FULL, ins_token)

error: Object of type 'int64' is not json serializable

Could you assist where am I going wrong.



  • tonystark
    I believe you are using pandas. If you are collecting the instrument tokens from any panda data structure it will be of a different type. You will have to convert that to native python integers to subscribe to WebSocket.
Sign In or Register to comment.