Facing same issue... Have you solved it ?
Question
FYERS API Unable to Execute the websocket(ws.FyersSocket(access_token, data_type="symbolData", symbol=symbol)) as an individual Thread.
Unable to Execute the websocket(ws.FyersSocket(access_token, data_type="symbolData", symbol=symbol)) as an individual Thread.
Join FYERS Community to pick others' brains on Trading/Investing
try this
data_type = "symbolData"
run_background = True
feedtoken = appId + ":" + access_token
symbol = ["NSE:SBIN-EQ", "NSE:ONGC-EQ"]
def custom_message(msg):
print(f"Custom:{msg}")
ws.websocket_data = custom_message
fs = ws.FyersSocket(access_token=feedtoken, run_background=False, log_path="/fyers/log/fyers_socket.log") # create this file
fs.websocket_data = custom_message
fs.subscribe(symbol=symbol, data_type=data_type)
fs.keep_running()