on_message callback not updating the order status sometimes

Order postbacks are not updated sometimes and status keep showing 'OPEN' despite the order already executed. Because of this problem, new orders are not getting placed as per my logic which requires last order to be COMPLETE before new order can be placed.

This is the on_message callback:
    def on_message(ws, payload, is_binary):
global my_order_messages
if not is_binary:
parsed_msg = json.loads(payload)
if parsed_msg['type'] == 'order':
if parsed_msg['data']['status'] in ['OPEN', 'COMPLETE', 'CANCELLED', 'REJECTED']:
order_id = parsed_msg['data']['order_id']
my_order_messages[order_id] = parsed_msg['data']
I found text messages in postbacks are not as reliable as they are claimed or am I missing something?
  • sujith
    Postbacks are only sent to third party apps if order is initiated from the that app. If not then it won't be sent. However, websocket updates are sent for every order.
    An order can be in OPEN status, even if it is partially filled. That is how it works. I would suggest use Kite web or app to know these kind of behaviors before writing strategies.
Sign In or Register to comment.