I am not getting order updates on Websocket. Today I placed 4 orders and websocket sent me the update only for the first one. Ticks are coming regularly. Everything is fine but no order updates.
My whole code is based on order updates from Websocket. If its not reliable, how can I proceed? Sometimes it sends update, sometimes it doesnt. How can one take serious trades with this uncertainty?
It does nothing. Just prints few things and updates few dictionaries.
It works well many times. Specially in the evening. If I punch a order now, I will immediately get the 'REJECTED' update. But it doesnt work flawlessly during market hours.
Strangely, the command goes through in the second try just after a second.
I had to include a try statement in my code to avoid this ConnectionError.
But you should look into why it happens.
def on_order_update(ws, data):
global order_status, order_latest_msg, order_update_list, pos_dict, trigs
data['sys_ts']=str(datetime.datetime.now())
print(str(data))
order_status[data['order_id']]=data['status']
order_latest_msg[data['order_id']]=data
order_update_list.append(data)
if data['transaction_type']=='BUY':
qty=data['filled_quantity']
else:
qty=-data['filled_quantity']
pos_dict[data['tradingsymbol']]=pos_dict[data['tradingsymbol']] + qty
print(qty)
print(data['transaction_type'])
It works well many times. Specially in the evening. If I punch a order now, I will immediately get the 'REJECTED' update. But it doesnt work flawlessly during market hours.
kite.order_history(order_id)
It throws a ConnectionError, but runs perfectly the 2nd time just after a second. I cant understand why?
Similarly kite.place_order also works in the second try not in the first.
I think, the problem described in https://kite.trade/forum/discussion/4217/bug-with-websockets-order-update#latest is true.