Hi, see there is api to get Orders, but it fetches all the orders. then i need to filter with status = "OPEN" is there any way we can put filter in input url like status = 'OPEN'?
If you pass the order id, you get a list in return. The list contains the different travel history of the ORDER like PUT ORDER RECEIVED, VALIDATION PENDING, OPEN, COMPLETE etc. You need to take the last record from the list which will be the current order status. You can use below function which will return only the ORDER_STATUS. This is in python.
def get_order_status(kite, order_id, record_location=-1): # Get the order status for particular order_id try: order_status = kite.order_history(order_id) order_status = order_status[record_location]["status"] return str(order_status) except Exception as e: logging.info("Unable to get order status: \n %s", e)
Is there any way we can put filter in input url like status = 'OPEN'?
No, currently we don't have a specific endpoint for the same. As stated, you can create function at your end, that loop-in through all orders and fetch order with status as open.
@ijigarpatel, Both are different functionalities. You need to loop through the order book and cancel all the pending orders. You need to loop through all of your positions and place the order with same quantity and product with the opposite transaction type to exit a position.
def get_order_status(kite, order_id, record_location=-1):
# Get the order status for particular order_id
try:
order_status = kite.order_history(order_id)
order_status = order_status[record_location]["status"]
return str(order_status)
except Exception as e:
logging.info("Unable to get order status: \n %s", e)
status
as open.Both are different functionalities.
You need to loop through the order book and cancel all the pending orders.
You need to loop through all of your positions and place the order with same quantity and product with the opposite transaction type to exit a position.