I recently tested my Fyers socket implementation with SymbolUpdate and DepthUpdate data types together.
It appears that the WebSocket ignores the data type DepthUpdate when it’s accompanied by SymbolUpdate or any other data type. Here, running the socket with the DepthUpdate data type with the same set of symbols works.
Is this possible? Am I doing something wrong here? (My code implementation below)
@handle_exception(svc=service)
def on_connect(self):
"""
Callback function to subscribe to data type and symbols upon WebSocket connection.
"""
# Specify the data type and symbols you want to subscribe to
data_type = "SymbolUpdate,DepthUpdate"
# data_type = "OnOrders"
# data_type = "OnPositions"
# data_type = "OnGeneral"
# data_type = "OnOrders,OnTrades,OnPositions,OnGeneral"
self.dataSocket.subscribe(data_type=data_type, symbols=self.symbol)
# Keep the socket running to receive real-time data
self.dataSocket.keep_running()
In the on_message function, I am just printing the message object,
elif msg['type'] == 'dp': # here type='dp' is depth update
print(msg)
Hello @aewitoADpV, you can create only one WebSocket connection instance at a time. This approach ensures stability and prevents issues that might arise from multiple concurrent connections. For more details, please refer to the following link: https://myapi.fyers.in/docsv3#tag/Web-Socket