Handling IOC order

vineet_dhandhania
Hi,

Say I do kite.place_order with validity set to IOC to buy 100 shares of a stock. I get order_id as response, right?

Say, 30 shares got filled. The remaining 70 got cancelled. What do I get in the postback?

(asking because I can't test it myself as I'm still in development stage and have not yet registered an api_key and there is no sandbox either)
Thanks!
Tagged:
  • vineet_dhandhania
    To be clearer, what is the status carried by the postback? Is it COMPLETE / UPDATE / CANCEL / REJECTED?
  • vineet_dhandhania
    @vivek , @tonystark , @sujith , @Kailash - Please give me this small piece of info. I have no way to try it out myself. Thanks!
  • codezed
    codezed edited June 2018
    you get order_id as response, which only means that the order is placed. no gaurantee that it will be executed.

    you need to query the trades or positions to know if the order was in fact executed.

    [Edit: I guess you already know this .. read your other posts, seems like you are looking for
    response in websocket..]
  • vineet_dhandhania
    @codezed Thanks. Yes, I am looking for websocket response. Polling order book is inefficient, on 2 counts - 1) program's response to order execution gets delayed until the next poll iteration, 2) polling increases load on Zerodha's servers because of HTTP requests which could be avoided.
  • sujith
    In case of regular orders, when there is a fill you will receive an order update with status UPDATE.
    In case of IOC (Immediate or cancel) there is no interim status, once order hits exchange order will be executed(can be partial fill also) or it will just be canceled.
    You will receive only one order update for an IOC order.
  • vineet_dhandhania
    @sujith Thanks.

    Please answer the following:
    Say I place an order for 100 shares with validity=IOC. What will be the postback status (CANCEL / UPDATE / COMPLETE / REJECTED) in the following 3 cases?

    Case 1: 40 got filled, remaining 60 got cancelled.
    Case 2: All 100 got filled.
    Case 3: 0 filled, all cancelled.

    Thanks!
  • sujith
    For case 1 you will receive 3 order updates with status OPEN, UPDATE and CANCELLED.
    For case 2 you will receive 3 order updates with status OPEN, UPDATE and COMPLETE.
    For case 3 you will receive 2 order updates with status OPEN and CANCELLED.
  • vineet_dhandhania
    @sujith Thanks a lot!

    .... and so there is an OPEN status too. I wish I knew about it earlier. I will have to rework. Sigh!

    Documentation on postbacks (https://kite.trade/docs/connect/v3/postbacks/) -
    • Only mentions these - COMPLETE, CANCEL, REJECTED, UPDATE
    • Has no mention of OPEN
    Documentation on orders (https://kite.trade/docs/connect/v3/orders/)
    • Mentions these - OPEN, COMPLETE, CANCELLED, and REJECTED
    • The same documentation carries another list of statuses that seems to be non-exhaustive with arbitrarily-chosen items (screenshot below)


    Could you please mention ALL the statuses in the documentation along with what they mean and what triggers them?

    Without proper documentation on order status postback, how do you hope people to not resort to polling of order book (which adds avoidable load on your servers)?

    Thanks again for your efforts.
  • sujith
    This is a new feature addition. We will update documentation.
  • vineet_dhandhania
    Great.. Thanks as always @sujith
  • vineet_dhandhania
    By the way, if you can informally share a quick list of order statuses sent via postback, I will be able to continue my development. It's a humble request o:) Thanks.
    On [email protected] please.
  • vineet_dhandhania
    @vivek It's not there. Request you to scroll up and read my longish message describing the matter. Thank you for your effort, again.
  • vineet_dhandhania
    @sujith
    Your answer on June 20 was incorrect. Please take DUE CARE with your replies.

    I am referring to your below answer.
    For case 1 you will receive 3 order updates with status OPEN, UPDATE and CANCELLED.
    For case 2 you will receive 3 order updates with status OPEN, UPDATE and COMPLETE.
    For case 3 you will receive 2 order updates with status OPEN and CANCELLED.

    Case 2 is incorrect. In Case 2, I received only OPEN and COMPLETE.

    Thank you for your effort nonetheless.
  • sujith
    I think it also depends on number trades also. If it executes in multiple trades then you will receive UPDATE status also since there will be a partial fill of the order.
  • vineet_dhandhania
    @sujith No. It does not depend on the number of trades. It's always only OPEN AND COMPLETE in Case 2.

    You were wrong in Case 1 also.
    In case 1, the only updates are OPEN and CANCELLED.
Sign In or Register to comment.