Websocket connection is not working

  • I am getting “Invalid request inputs” as response for few symbols like ABBOTINDIA23SEPFUT, ASIANPAINT23SEPFUT etc for real time data via websocket.

Response:{‘s’: ‘error’, ‘code’: -1200, ‘message’: ‘Invalid request inputs’}

  • When symbols= [“NSE:SBIN-EQ”,“NSE:ASIANPAINT23SEPFUT”] then data for “NSE:SBIN-EQ” is also not coming. When I run without NSE:ASIANPAINT23SEPFUT then data for SBIN is coming for real time data via websocket.
    a) My question is why symbols impact each other in this case ASIANPAINT23SEPFUT is impacting SBIN?
    b) There should not be such dependencies otherwise we won’t be able to get real time data data via websocket for symbols due to one of the symbol behaving as in case 1.
    For Ex: symbols=[“A”,“B”,“C”,“D”,“E”], Let’s say E has some problems mentioned in case 1 above then due to this, we are not getting real time data via websocket for A,B,C,D symbols as well.

Can you please help why it’s happening? Appreciate your help!

Thanks!

Hi Team, can you please check this?

Hi @badal793-ced ,

  1. If you are passing symbols which are not traded or price are not moving so it will not come in websocket.
  2. No, you will receive data for SBIN. In the list [“A”, “B”, “C”, “D”, “E”], if there is an issue with “E,” data for A, B, C, and D will still come.

@ZppA1qLXjC when I am running with symbols= [“NSE:SBIN-EQ”,“NSE:ASIANPAINT23SEPFUT”] then getting
Response:{‘s’: ‘error’, ‘code’: -1200, ‘message’: ‘Invalid request inputs’} error, no data for SBIN.

Below is code snippet I am running, you can try as well:

from fyers_api.Websocket import ws
access_token = ""
data_type = "symbolData"
symbols= ["NSE:SBIN-EQ","NSE:ASIANPAINT23SEPFUT"] # not working
# symbols= ["NSE:SBIN-EQ"]  # working

def custom_message(msg):
    print (f"Custom:{msg}")

ws.websocket_data = custom_message
fyersSocket = ws.FyersSocket(access_token=access_token,run_background=False,log_path="./logs")
fyersSocket.subscribe(symbol=symbols,data_type=data_type)
fyersSocket.keep_running()

Hi @badal793-ced ,

The WebSocket is functioning properly, and I even tested it with your provided code, and the data is updating as expected. I kindly request you to double-check your implementation, as there seem to be no issues on our end. If you encounter any problems, please share a screenshot of the error message so that I can assist you further.