How to reliably identify SL orders for BO order

amamarde
Hey there,

I know how to place BO order from API and the fact that, only on completion of it, it's corresponding SL and Target orders are placed.

But my question is, how to identify what orders (order_id) are placed? It could be even more than one target and sl orders. So in that case would require to know all such order_ids.

I have tried listening to postback url updates, but it only sends updates when the corresponding SL/Target order is Completed/Cancelled.

Websocket order updates, does have this info, but still its difficult to get out this info reliably from it as it sometimes posts updates multiple times, sometimes updates are missed (if n/w / socket connection is dropped etc).

And the third way, which I am using currently, to call get orders API and then iterating through and then identifying using parent order id and order type of each. This way is reliable but not proper as it requires to call get orders repetitively (polling) until we get the sl and target order ids.

I am looking out for any other option for finding this info reliably? is there any API available to pass in the parent order id and to get all of its child order ids? can it be provided? It would be very helpful for API users as BO order feature is one of the best offering from Zerodha, but API users cant use its full power until we get such quick & reliable way of finding all targets and sl order ids.

Thanks for any help in advance!
-Abhijit
  • sujith
    sujith edited September 2018
    Hi Abhijit,
    You don't have to poll orderbook, you can fetch and keep it at your end and re-fetch only when there is an order update. You can loop through cached orders to fetch all child orders.

    Kite Connect is purely an execution platform, we don't provide any kind of support or solutions for writing strategies.
  • amamarde
    @sujith

    fetching orders everytime on order update sounds again non reliable solution, as sometimes we dont get order updates, either through postback url or websock updates.

    I am not asking for support to build strategy but may be adding one more kite API which would simply return lists of SL and Target order ids for given parent order id.

    Please add this in your road-map!
Sign In or Register to comment.