Skip to content
Order Modification

Modify Attached Orders

Modifies only the take-profit and stop-loss orders attached to a main order, without changing the main order. You can change the trigger prices, the order prices after activation, the activated order type and session, and the time in force. When attached_order_type=0 and cancel_all_attached=true, all attached orders are canceled. Pass the main order ID (main_id), the main order quantity, and the current market price. To modify the main order at the same time, use POST /v1/tube/replace with the attached order parameters in attached_params. A successful response means only that the modification request was accepted; check the final state through the order details or order push updates. On success, refresh the order list and assets. On failure, show message; the original order remains unchanged.

When you call this operation through WhaleCore requestService(), set requiresTradeToken to true.

WhaleCore's orderService() wraps this endpoint as the typed method replaceAttachedOrder. If you use WhaleCore, prefer that method.

POSThttps://api.lbkrs.com/v1/attached_order/replace

Request body application/json

attached_order_typeintegerrequired

Attached order type:

  • 0 - No attached order; if the original order has attached orders, also pass cancel_all_attached=true to cancel them all
  • 1 - Take-profit order
  • 2 - Stop-loss order
  • 3 - Bracket order (both take-profit and stop-loss)
Values
0
1
2
3
profit_taker_pricestring

Take-profit trigger price

profit_taker_idstring

ID of the existing take-profit order; pass it when modifying that order

profit_taker_submit_pricestring

Order price after the take-profit order is activated; pass it when the activated order type is a limit type

stop_loss_pricestring

Stop-loss trigger price

stop_loss_idstring

ID of the existing stop-loss order; pass it when modifying that order

stop_loss_submit_pricestring

Order price after the stop-loss order is activated; pass it when the activated order type is a limit type

activate_order_typestring

Order type after the attached order is activated

activate_rthstring

Trading session after the attached order is activated:

  • 1 - Pre-market and after-hours not allowed
  • 2 - Pre-market and after-hours allowed
time_in_forceinteger

Time in force:

  • 0 - Day
  • 1 - Good till canceled (GTC)
  • 3 - Immediate or cancel (IOC)
  • 5 - Fill or kill (FOK)
  • 6 - Good till date (GTD); an expiry time is also required
Values
0
1
3
5
6
expire_timestring

Expiry time as a Unix timestamp in seconds; required when time_in_force=6

cancel_all_attachedboolean

Whether to cancel all attached orders of the main order

main_idstringrequired

Main order ID; required when you modify only the attached orders

quantitystring

Total quantity of the main order; pass it when you modify only the attached orders

market_pricestring

Current market price, including pre-market and after-hours; pass it when you modify only the attached orders

Responses

HTTP 200The request succeeded. The response body contains the result of the “Modify Attached Orders” operation.
Standard response envelopecodemessagedata
dataobjectdata structure

No business fields

No nested fields

Whale Docs