def on_ticks(ws, ticks): # Callback to receive ticks. print("Inside on_ticks") logging.debug("Ticks: {}".format(ticks)) for tick in ticks: for stock in stocks: if stock.instrument==tick["instrument_token"]: stock.update(tick) ##if stock.recommend!=0: ## if recommend =1 buy, 2 close sell and open buy position, -2 close buy and open sell positio
You are blocking main ticker thread, by performing computation inside on_ticks. You can go through this thread to know more.
on_ticks
. You can go through this thread to know more.