What order status do we get if we cancel a partially filled order

suprxd
Suppose I place a limit order of 100 quantity in NIFTY CE. Out of which only 50 quantity is filled.
In between this, if I cancel the order, will the order be market as CANCELLED? or COMPLETED?
Tagged:
  • Lakshmi
    Lakshmi edited January 5
    as per my understanding,

    If you place a limit order for 100 quantity in NIFTY CE and only 50 gets filled before you cancel it, the order will be marked as
    CANCELLED
    , not <code class="CodeInline">COMPLETED.

    Here’s how it works: the 50 quantity that got executed will remain as a completed trade in your trade history. But since the remaining 50 wasn’t filled and you canceled it, the status of the overall order in the order book will show as **CANCELLED**.

    So, even though part of the order was completed, the system marks the whole order as canceled because the full 100 wasn’t filled before you stopped it.
  • suprxd
    Kindly help. I am trying to write code for this case.
  • Lakshmi
    as per my view:


    If you place a limit order for 100 quantity in NIFTY CE and only 50 gets filled before you cancel it, the order will be marked as CANCELLED, not COMPLETED.

    Here’s how it works: the 50 quantity that got executed will remain as a completed trade in your trade history. But since the remaining 50 wasn’t filled and you canceled it, the status of the overall order in the order book will show as CANCELLED.

    So, even though part of the order was completed, the system marks the whole order as canceled because the full 100 wasn’t filled before you stopped it.
  • sujith
    The order status will not change for a partially filled order. It will remain OPEN even if one trade has executed. The status will change to CANCELLED if you cancel the order but filled_quantity will not be 0.
  • suprxd
    Thanks @Lakshmi @sujith

    I was only able to reproduce it once, however with large quantities it might not be rare.

    Last time when I got this case, zerodha started showing pnl for filled quantity. I doubt if I cancel the order the order has to be marked completed rather than cancelled for 2 reasons,
    1. Cancelled order can not have open position.
    2. There's a field called "cancelled_quantity" in order post-back data mentioned in the Documentation which should represent the number of quantity cancelled.

    Let me know if I am incorrect. Thanks
Sign In or Register to comment.