Hi, I have placed an order and the postback url is giving me the data for the parent order. However, how do i get the data for the child orders as my order is a BO and is multilegged. Here are the values: Order id for the order placed successfully 170227000343189. If i do a getOrder() for this order id in my java code. i get the following response
order.orders.get(i).orderId : order.orders.get(i).parentOrderId : status 170227000343189 : null : COMPLETE 170227000343189 : null : OPEN 170227000343189 :null : OPEN 170227000343189 :null : OPEN 170227000343189 :null : OPEN PENDING 170227000343189 :null : VALIDATION PENDING 170227000343189 :null : PUT ORDER REQ RECEIVED
WHY do i get child order id for all the items same as parent order id?
Hi @quicksilverm, 1. getOrder(order_id) will give you lifecycle of an order in the system. As you can see all states it has gone through till it has reached complete status. 2. You need to fetch orderbook after BO first leg completion and filter orders whose parent order id is same as postback order id.
2. You need to fetch orderbook after BO first leg completion and filter orders whose parent order id is same as postback order id.
How would I be notified that the 1st leg has been completed ? I do have postback URL configured. Would I get the notification there ?
2. I thought instead of fetching the orderbook ( getOrder() API ) , I would instead run getTrades(orderID) which would tell me about all my individual trades ?
3. Documentation says that getTrades(orderID) tells about the various legs of the order, but then it doesn't tell me whether the respective trades is a SL-M or LIMIT.....if I need to modify the order based on my algo, I do not know what to co-orelate
4. If for above point (3), I need to run getOrder()
Empty Parenthesis
, then would it solve all my purpose .....to identify which orders are LIMIT and which are SL-M .
5. If getOrder() is what it takes, then what is the purpose of getTrade(OrderId). Is there a value in having this call. Perhaps I am missing out on something which is confusing me
@sujith@Kailash Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this - 1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000 2. I get parentID which is nothing but order.orderID from above. 3. My quantity is huge so it would be creating multi-leg order. 4. I have postback URL configured which would notify me when the order gets placed.
Would the postback URI also notify when the order gets cancelled or exited or executed, when it reaches it's target ?
5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state 6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this.....
Which API would work for me here ? I didn't want to run getOrder() since if there are a lot of trades in a day then this will be quite bulky....isn't it ?
7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades, 8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.
How would I be notified that the 1st leg has been completed ? I do have postback URL configured. Would I get the notification there ?
Yes, you will get postback after the first leg is executed.
getTrades(order_id) will give you a list of trades that happened for the given order id which will not contain any details about child orders.
The only feasible solution for this is to fetch orderbook(getOrder()) and check for pending orders with parent order id same as postback order id. You can check order type field to know whether it is limit or stoploss order.
How would I be notified that the 1st leg has been completed ? I do have postback URL configured. Would I get the notification there ?
Ideally, you must get postback but as of now because of some bug, you will not be receiving postback for the second leg execution. We are working on fixing this issue.
@sujith@Kailash Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this - 1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000 2. I get parentID which is nothing but order.orderID from above. 3. My quantity is huge so it would be creating multi-leg order. 4. I have postback URL configured which would notify me when the order gets placed.
Would the postback URI also notify when the order gets cancelled or exited or executed, when it reaches it's target ?
5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state 6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this.....
Which API would work for me here ? I didn't want to run getOrder() since if there are a lot of trades in a day then this will be quite bulky....isn't it ?
7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades, 8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.
@sujith@Kailash Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this - 1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000 2. I get parentID which is nothing but order.orderID from above. 3. My quantity is huge so it would be creating multi-leg order. 4. I have postback URL configured which would notify me when the order gets placed.
Would the postback URI also notify when the order gets cancelled or exited or executed, when it reaches it's target ?
5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state 6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this.....
Which API would work for me here ? I didn't want to run getOrder() since if there are a lot of trades in a day then this will be quite bulky....isn't it ?
7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades, 8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.
1. getOrder(order_id) will give you lifecycle of an order in the system. As you can see all states it has gone through till it has reached complete status.
2. You need to fetch orderbook after BO first leg completion and filter orders whose parent order id is same as postback order id.
2. I thought instead of fetching the orderbook ( getOrder() API ) , I would instead run getTrades(orderID) which would tell me about all my individual trades ?
3. Documentation says that getTrades(orderID) tells about the various legs of the order, but then it doesn't tell me whether the respective trades is a SL-M or LIMIT.....if I need to modify the order based on my algo, I do not know what to co-orelate
4. If for above point (3), I need to run getOrder() , then would it solve all my purpose .....to identify which orders are LIMIT and which are SL-M .
5. If getOrder() is what it takes, then what is the purpose of getTrade(OrderId). Is there a value in having this call. Perhaps I am missing out on something which is confusing me
Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this -
1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000
2. I get parentID which is nothing but order.orderID from above.
3. My quantity is huge so it would be creating multi-leg order.
4. I have postback URL configured which would notify me when the order gets placed. 5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state
6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this..... 7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades,
8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.
getTrades(order_id) will give you a list of trades that happened for the given order id which will not contain any details about child orders.
The only feasible solution for this is to fetch orderbook(getOrder()) and check for pending orders with parent order id same as postback order id.
You can check order type field to know whether it is limit or stoploss order. Ideally, you must get postback but as of now because of some bug, you will not be receiving postback for the second leg execution. We are working on fixing this issue.
Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this -
1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000
2. I get parentID which is nothing but order.orderID from above.
3. My quantity is huge so it would be creating multi-leg order.
4. I have postback URL configured which would notify me when the order gets placed. 5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state
6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this..... 7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades,
8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.
Let me a bit more clear so that you can precisely answer my query. Also do try to answer my above mentioned queries as well.
My order flow is this -
1. I place a BO from my algo. Order order = zerodha.placeorder(myOrder) where myorder.quantity=10000
2. I get parentID which is nothing but order.orderID from above.
3. My quantity is huge so it would be creating multi-leg order.
4. I have postback URL configured which would notify me when the order gets placed. 5. Presuming that the order for 10000 stocks got executed, I would imagine there would be couple of pairs of (LIMIT<==>SL-M) ( OPEN==PENDING) state
6. As the stock goes up, I would like to modify my target and for this I believe I need to modify each of the individual legs. I need a child_order_id to achieve this..... 7. I thought getTrades(orderID) would just fetch me everything for only that order, but then I don't think it gives any pending or open orders and seems to only focus on EXECUTED trades,
8. I would like to fetch the childOrders in the most effecient manner given a parent_ORDER_ID. What is the best way to achieve this.