Skip to content
Order Modification

Modify Stock Order

Modifies the price, quantity, or amount of an open stock order and can adjust the attached take-profit and stop-loss orders at the same time. It applies to regular orders and triggered conditional orders. Use POST /v1/povs/replace for conditional orders that have not been triggered, POST /v1/tube/stock_contract/replace for options orders, and POST /v1/attached_order/replace to modify only the attached orders. Omit price for market orders; the price of a limit-type order cannot be 0. 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 replaceOrder. If you use WhaleCore, prefer that method.

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

Request body application/json

order_idstringrequired

ID of the order to modify

order_id_strstring

String form of the order ID; pass the same value as order_id

quantitystringrequired

New order quantity

pricestring

New order price; omit it for market orders. It cannot be 0

submitted_amountstring

New order amount; pass it when modifying an amount-based order, such as a US fractional share order, by amount

attached_paramsobject

Parameters for modifying attached take-profit and stop-loss orders

Child attributes
attached_order_typeinteger

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_idstring

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 Stock Order” operation.
Standard response envelopecodemessagedata
dataobjectdata structure
order_idstring

ID of the modified order

Whale Docs