Intermediate order status "UPDATE" in Constants

Sandeep_Prakash
It would be good to add the intermediate order status "UPDATE" as most orders are executed partially and we may have to place the stop loss for the partially executed orders.
  • sujith
    can you elaborate?
  • Sandeep_Prakash
    From the logs, here is the sequence of events (order) that we get after an order is placed.

    10:28:00.867 [TRACE] Enter onOrderUpdate with (order = {"exchange_order_id":"XXXXXXXXXXXXXXXX","disclosed_quantity":"0","validity":"DAY","tradingsymbol":"BANKNIFTY21N1139200PE","variety":"regular","order_type":"LIMIT","trigger_price":"0","price":"385.75","status":"OPEN","product":"MIS","placed_by":"XXXXXX","exchange":"NFO","order_id":"YYYYYYYYYYYYYYY","pending_quantity":"100","order_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_update_timestamp":"Nov 8, 2021, 10:28:00 AM","average_price":"0","transaction_type":"SELL","filled_quantity":"0","quantity":"100","tag":"TAG","guid":"ZZZZZZZZZZZZZZZZZZ"})
    10:28:00.870 [TRACE] Enter onOrderUpdate with (order = {"exchange_order_id":"XXXXXXXXXXXXXXXX","disclosed_quantity":"0","validity":"DAY","tradingsymbol":"BANKNIFTY21N1139200PE","variety":"regular","order_type":"LIMIT","trigger_price":"0","price":"385.75","status":"UPDATE","product":"MIS","placed_by":"XXXXXX","exchange":"NFO","order_id":"YYYYYYYYYYYYYYY","pending_quantity":"75","order_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_update_timestamp":"Nov 8, 2021, 10:28:00 AM","average_price":"386.4","transaction_type":"SELL","filled_quantity":"25","quantity":"100","tag":"TAG","guid":"ZZZZZZZZZZZZZZZZZZ"})
    10:28:00.874 [TRACE] Enter onOrderUpdate with (order = {"exchange_order_id":"XXXXXXXXXXXXXXXX","disclosed_quantity":"0","validity":"DAY","tradingsymbol":"BANKNIFTY21N1139200PE","variety":"regular","order_type":"LIMIT","trigger_price":"0","price":"385.75","status":"UPDATE","product":"MIS","placed_by":"XXXXXX","exchange":"NFO","order_id":"YYYYYYYYYYYYYYY","pending_quantity":"50","order_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_update_timestamp":"Nov 8, 2021, 10:28:00 AM","average_price":"386.375","transaction_type":"SELL","filled_quantity":"50","quantity":"100","tag":"TAG","guid":"ZZZZZZZZZZZZZZZZZZ"})
    10:28:00.896 [TRACE] Enter onOrderUpdate with (order = {"exchange_order_id":"XXXXXXXXXXXXXXXX","disclosed_quantity":"0","validity":"DAY","tradingsymbol":"BANKNIFTY21N1139200PE","variety":"regular","order_type":"LIMIT","trigger_price":"0","price":"385.75","status":"COMPLETE","product":"MIS","placed_by":"XXXXXX","exchange":"NFO","order_id":"YYYYYYYYYYYYYYY","pending_quantity":"0","order_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_timestamp":"Nov 8, 2021, 10:28:00 AM","exchange_update_timestamp":"Nov 8, 2021, 10:28:00 AM","average_price":"386.3375","transaction_type":"SELL","filled_quantity":"100","quantity":"100","tag":"TAG","guid":"ZZZZZZZZZZZZZZZZZZ"})
    So, the order status remains as "UPDATE" until the complete order is filled.

    For the partially filled orders I would want to place the StopLoss immediately and not wait for the complete order to be filled.

    NOTE: Here the Order is filled almost immediately. But suppose the price doesn't return to the LIMIT price, then Partial order will remain as it is.

    No doubt, I can add "UPDATE" as a String, and live with it. It's just that it may be a good idea as I think many may use it.
  • Sandeep_Prakash
    Also, can you please clarify the following:

    If order status "OPEN" will be sent mandatorily.

    Also, please correct me if I'm wrong, these events are async and "OPEN" order can come after "UPDATE" or even after "COMPLETE" is it not?

    And the intermediate status like "UPDATE" may not be sent at all.
  • sujith
    @Sandeep_Prakash,
    The order update events are async and are send by the OMS. We just relay them. The correct practice is to pull orderbook or order history when you receive an order update.

    UPDATE is not a real status of the order, it is a place holder in postbacks or order updates. You can check all interim statuses in order history API.
Sign In or Register to comment.