Getting the order price on market type cover orders

After placing a Cover Order at market price (via PHP API), how do I get the price at which it was executed?

Would this work:
$order = $kite->getOrderHistory( '180111000830542' );
$order_price = $order->average_price
  • sujith
    You can fetch orderbook and look for the average_price field.
  • sujith
    You don't need order history for that. If you use orderbook then there will be one less API call to make.
  • thepunisher
    @sujith But the order book will return all orders placed during the day and I have to loop through them to get the order I want. So isn't using getOrderHistory with order_id simpler?
  • sujith
    Looping through 1000 order items (worst case scenario) will not even take a second with today's hardware capabilities.
    But I am not aware of the context of your script. So it is just a suggestion if it doesn't work then leave it.
Sign In or Register to comment.