partially filled order

raja1sttarde
Hello,

If an order is placed for 100 units and 60 have been filled. To cancel the unfilled quantity do I do a modifyorder() and change the order amount equalling the filled amount?

Thanks!
Tagged:
  • sujith
    You can cancel a partially filled order.
  • raja1sttarde
    A cancel order on partially filled order will move the pending amount to cancelled column and mark the orderID as complete?

    Thanks.
  • sujith
    Nope, the status will be cancelled for a cancelled order.
    Yes, the remaining blocked margin will be released.
  • raja1sttarde
    Hi,

    If I put in a order of XYZ script for 100 units in LIMIT, and 60 get filled.
    Say the orderID is 123456.
    if i do cancelOrder(123456).
    the the pending 40 units will be marked 'CANCELLED', 60 units marked "FILLED", avgPrice=>(n1*price1 + n2*price2...)/qtyFilled, and status will be marked "COMPLETE", yes?

    If not,
    a) how do I cancel the pending quantity of a partially filled order
    b) how is the order marked.
    c) is a new order id generated?

    Thanks.
  • sujith
    You seem to be confused between a trade and an order.
    There is only one status for an order.
    Assuming you placed a limit order. If 60 quantity of an instrument is filled out of 100 then the order status will remain open since it was in open status before 60 quantity is filled.
    For each fill (trade), there is a unique id (trade id) which can be found in tradebook.
    Once an order is placed the order id remains same even after execution.

    I think an easier way to know is placing a couple of orders on Kite Web and take a look at orderbook.
  • raja1sttarde
    @sujit bhai, i really appreciate you taking the to time to answer my questions.

    but i don't know how i can be more clearer. My question is how to cancel partial filled order

    to reiterate;

    a) how do I cancel the pending quantity of a partially filled order
    b) how is the order marked.
  • HowUTrade
    @raja1sttarde

    Taking your example case
    Stock : XYZ
    Qty : 100
    Filled : 60

    There are two options to cancel the order, pls note you are just cancelling the unfilled qty, you have already open position for filled qty.

    1. Normal Cancel of Order
    The following will be the order state
    Order Qty : 100
    Filled Qty : 60
    Cancelled Qty : 40
    Order Status : CANCELLED
    Filled Price : xxxx.xx

    2. Modify the Order to that of Filled Qty i.e. 60
    Send a modify order request with quantity as 60
    The following will be the order state
    Order Qty : 60
    Filled Qty : 60
    Cancelled Qty : 0
    Order Status : COMPLETE
    Filled Price : xxxx.xx

    Point to note here is, 'CANCELLED' order status doesn't mean that the order is not at all executed.
    When work with 'CANCELLED' order always check FilledQty or FilledPrice to confirm partial fills.
  • raja1sttarde
    @HowUTrade thank you!! that is exactly what i wanted to know.

    In scenario 2,
    Filled qty = 60
    I send a modifyOrder(orderis=123, qty=>60) request
    before it reaches the exchange 1 more unit gets filled, hence order id:123 has 61 filledQty

    Here I would get a 'REJECTED' status, yes?

    Where as if i did cancelOrder(orderid=123),
    it would get status='CANCELLED', filledQty=61, yes?

    Thanks for your time!
  • HowUTrade
    @raja1sttarde

    Case 1: If the modify Qty is less than Filled Qty (for whatever reason), then the order will not be modified and last order status before modify request will hold good. Means
    Order Status : OPEN
    Order Qty : 100
    Filled Qty : 61
    Pending Qty : 39

    Case 2 : Yes
    Order Status : CANCELLED
    Order Qty : 100
    Filled Qty : 61
    Cancelled Qty : 39
  • raja1sttarde
    @HowUTrade super! thank you very much!

    can I modify a partial filled order to 'MARKET' from 'LIMIT' ?
    if so, when placing a 'MARKET' order, if the parameter array contains 'price=>0.00' or 'price=>123.50' will the price information be ignored and order placed as 'MARKET'? or do I need to unset irrelevant parameters in array?

    Thanks!
  • HowUTrade
    @raja1sttarde

    Yes, when you modify a LIMIT order to MARKET, price is irrelevant, your order will always executed at the best price available.
    For the sake of clarity, just pass Ltp or your original price while sending modify request.

    But make sure you are sending the same original quantity (Just ignore what is filled and what is not).
This discussion has been closed.