Order check after placement

rajukumarpu9
Hi Team,

I'm checking order is placed with exchange or not after placing order. sometimes I get the order is placed but sometimes I didn't found order placed with exchange although the order placed successfully.

due to above issue software places the same order again, which is already placed.

Please do let me know how can I avoid this situation ? should I need to give some time before checking the placed order over exchange, if yes then what should be ideal time gap order placement and re-check of the same order?

Please reply asap.

Thank you.
Regards,
Raju
Tagged:
  • ZI4453
    declare a dictionary with a last "transaction status", read that value before you place request for any transactions.
    if you are not into FT you can store them in db and read whenever you want make a transcation.

    note:-make sure you update entire transaction status of order flow
  • rajukumarpu9
    yes, storing all transaction status in a dictionary and writing into a file.

    I want to check whenever I place a sl order, it's placed or not successfully.

    The same piece of code working fine for some orders and not for others.

    I fetch the placed orders using kite.orders() as soon as I placed the order.

    should I give any delay before fetching order book since sometimes I'm able to get it correctly but sometimes I'm unable to get my placed order and later noticed it's already placed.

    or should I not to retry placing order if once placed using api.

    I'm checking this in case order may get rejected due to price limit or some other reason show that I can place another order.


  • ZI4453
    how are you reading response ? are you updating "Exchange responses " or updating response of your post requests ? If there are child orders involved then you will really have to very cautious in OMS.

    please review your code like this :-1:
    status dictionary =''
    whats my Position/holdings->how many i am planning to buy/sell now ->Child orderinvolved?

    Status dictionary should always be updated by "exchanges response", if its multiple order i would suggest you to use seperate dictionary for Quantity if not Exchange status+str(Quantity). So that you can decode it back when you are about place any orders.

    how are you placing orders ? are they placed in one go ? or you are placing orders in for loop ?
  • sujith
    @rajukumarpu9,
    Give some 100 or 200 ms delay before you check orderbook. It takes a while to update orderbook after placing the order.
  • rajukumarpu9
    Hi @ZI4453,

    There is no child order involved.
    I'm placing simple MIS SL-M order if my earlier placed order executed.

    Since, I'm placing stop loss order for executed order. I just want to make sure that my SL - loss order is placed successfully.

    SIMPLE example>
    primary order
    {"date_time": "2019-08-26 09:20:05", "scrip_name": "GAIL", "trade_type": "SHORT", "sell_price": 124.35, "position": 2089, "stop_loss": 126.2, "order_id": "190826000207330", "status": "TRIGGER PENDING"}

    AS soon as this order get executed

    Placing another order SL-M order

    sl_order: {"scrip_name": "GAIL", "trade_type": "LONG", "buy_price": 126.2, "position": 2089, "status": "None"}

    once sl-order placed by api , checking sl_order with order book .

    Note: - there is no time gap between placing order and checking with order book.

    I think, I should give time to reflect my order book as your team suggested to put atleast 200ms gap .

    Please do let me know if have other approach to check weather order is placed successfully or not.
    Kindly share code, if you have any

  • ZI4453
    @rajukumarpu9 Sir - i dont represent Z. i am also a dev/trader like you.

    to give you exact solution we need more details than this... But please try placing gap between orders first and check your code's behavior.Also if order is filled try filling up its quantity in its status along with "trade".

    Keep your code aligned to stream data...if you are not in any FT or momentum trading reading Order book(GET Call) should not be a concern.
  • rajukumarpu9
    Hi @ZI4453 ,

    Thanks for the information. I will put some time gap between placing order and checking order book.
Sign In or Register to comment.