How to find the status of an order

Hey all ,

I want to sell a share which i brought some time before but not confirm that it was executed or not . So , can anyone tell me how to know the new status of the buy order that i put some time before . And can anyone tell me what's the key and value for the returned map for the getPositions() and how it works .

Thanks in advance
  • venun
    venun edited December 2017
    if buy quantity >0 means you have a buy position
    if = 0 no position
    if < 0 sell position
  • rksingh
    rksingh edited December 2017
    I am posting my code(in python) which I use...
    Whenever we place order, we get order id. Below code uses this order id to check if placed order was successful or not...Hope this helps
    def placed_order_status(self, order_id):
    # check status of orders placed if successful or not
    self.order_successful = False
    if len(kite.trades(order_id)) == 0:
    print("Order placement failed for order_id ",order_id)
    self.order_successful = True
    print("Order Successful")
  • rksingh
    rksingh edited December 2017
    Below is my code to check open position(in python) if there exist any.
    This is the first step of my code. I use this data for various action

    def check_open_position(self): = ' '
    self.product = ' '
    self.transaction_type = ' '
    self.qty = 0
    self.order_type = ' '
    # check if there exist any open position from previous/current day
    for i in range(0,len(kite.positions()['net'])):
    if (kite.positions()['net'][i]['buy_quantity'] !=
    if kite.positions()['net'][0]['sell_quantity'] > 0:
    if kite.positions()['net'][0]['buy_quantity'] > 0:
    self.buy_price = kite.positions()['net'][0]['buy_price']
    self.position = 'Y'
    print ('Open Position: ',self.trading_symbol,,self.qty,self.product,self.transaction_type)

  • sujith
    I think the easier way is to fetch orderbook and find order id which you got from order place response and check for status contains COMPLETE.
    If COMPLETE then you fetch positions.
    In the above code, you have too many conditions and to save bandwidth store positions response. In the above code to check one if statement you seem to making multiple API calls.
  • saurabh3679
    what are the other status possible? rejected, open, pending, partially executed?
This discussion has been closed.