I am using the Delta Exchange API for trading and would like to understand how to place bracket orders via API. Specifically, I want to:
Place a buy order when the price reaches a certain level (a stop entry order).
Set a stop-loss below the entry price.
Set a target above the entry price.
For example, if the current market price is 100, I want to:
Place a buy order at 105 (when the price reaches 105).
Set a stop-loss at 103.
Set a target at 109.
Could you please guide me on how to structure the API request for this? If possible, I would really appreciate an example request body to understand the parameters better.
you can give buy order with order type = stop loss limit, trigger = 100, limit = 105 to make an entry; or stop loss market with trigger =100 side = buy.
Yes, when you want to edit a bracket order (the stop loss or take profit parameters) that is attached to a limit order, you need to use the order ID of the parent order (the main limit order).
the problem here is after bracket order is placed and when i try to edit the order
{‘error’: {‘code’: ‘open_order_not_found’}, ‘success’: False} this is what comes . in delta webpage also these orders are under stop order rather than on open orders.
The error open_order_not_found means that the order with the given Id is no longer open and either it is filled or cancelled so you can’t edit it.
If it is filled, then bracket orders are created with their own Ids and they can be edited separately using those Ids.
@johngeorge The orders should be shown into your active orders section until the position is closed or one of the bracket orders get executed.
Their states wil be be pending if they are not triggered and open if they are triggered but not executed. Their stop_order_type will be either stop_loss_order or take_profit_order.
Get Active Orders API: Delta Exchange Api