how to get average price of executed order ?

rohitm
Is there a way to get average price of an executed order using order_id ?
  • rakeshr
    Yes, you can know the average price at which the order was executed. Check attribute detail here.
  • rohitm
    can you help with an example ? giving order id like below isn't working . orders doesn't take argument

    print(kite.orders(210504003918028))
  • rakeshr
    kite.orders
    This fetches complete order book. So, it doesn't take input param.
    can you help with an example ?
    To get required order_id average_price, you will have to iterate whole order book, filter required order_id(eg: 210504003918028 here) and extract average_price from the same. Or you can use order trades APIs(this takes order_id as input) to fetch all trades for required order_id and extract average_price for the same.
  • SAPANKHUNTIA
    hi @rakeshr
    I'm finding it difficult to write a code for the get request to fetch the trades of a particular order_id.
    https://kite.trade/docs/connect/v3/orders/#retrieving-an-orders-trades
    can you please help me with this ?
    Thank you.
  • RED
    @SAPANKHUNTIA ,
    use kite.order_history(orderid), if individual fetch suffices.

    If you use websockets and store all your trades, then use kite.orders() and collate with your local storage. if any mismatch, add them to your storage and update your positionbook accordingly with user interrupt, for cross-verification.
Sign In or Register to comment.