It looks like you're new here. If you want to get involved, click one of these buttons!
def on_order_update(ws, data):
log_to_file_nopos(f"ON_ORDER_UPDATE_DATA >>> {data}")
p = 0
while True:
p += 1
try:
kite_orders.append(kite.orders())
log_to_file_nopos(f"added details of order_id {kite_orders[-1][-1]['order_id']}")
log_to_file_nopos(f"value of p is {p}")
break
except:
log_to_file_nopos("orders error in on_order_update")
time.sleep(2)
pass
As per the docs on_order_update is automatically called when a status of an order changes. Therefore kite_orders list must also get updated with it. With this information I coded to use kite_orders elsewhere and waiting for 0.1 or 0.2 seconds for it to be updated under a while True break
loop.