i am writing the following code to trap the ststus of my order: Dictionary response = new Dictionary(); response = kite.PlaceOrder( Exchange: exchange, TradingSymbol: scriptName, TransactionType: Constants.TRANSACTION_TYPE_BUY, Quantity: quantity, Price: 270, //Price: 156.5000m, OrderType: Constants.ORDER_TYPE_LIMIT, Product: Product ); console.writeln(response["status"]
the aove code prints the status as "Success" while my order book shows the order as "REJECTED" . kindly help to trap the correct status.
You can go through the API response structure here. A successful response structure will return the status key with the value success. You can go through the order placement response structure here.
Thanks for your reply. I already get SUCCESS as response for Order Placement status. What I am trying to trap is the Execution status, ie, OPEN, COMPLETE, CANCELLED, or REJECTED after order placement is SUCCESS. I am unable to get these.. can you please support? Thanks.
Use this bit of code, change acording to yr requirement.
try: order_status = kite.order_history(order_id) except requests.exceptions.Timeout: print ("030.>> A Timeout has occurred for fetching call order history so, will go to next step.") except Exception as e: print("031.>> Could not fetch order history details because " + str(e)) print("032.>> We will continue with fresh loop.") continue
if type(order_status) == list: order_status = [s['status'] for s in order_status] order_status = order_status[-1]
You can go through the order placement response structure here.
try:
order_status = kite.order_history(order_id)
except requests.exceptions.Timeout:
print ("030.>> A Timeout has occurred for fetching call order history so, will go to next step.")
except Exception as e:
print("031.>> Could not fetch order history details because " + str(e))
print("032.>> We will continue with fresh loop.")
continue
if type(order_status) == list:
order_status = [s['status'] for s in order_status]
order_status = order_status[-1]