Trade
Authorization
Signed mode: every request is signed with your App Key/Secret. Header set:
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string · header | Required | The account Access Token from the OpenAPI dashboard — passed as the raw token (no Bearer prefix) and included in the signature calculation. |
X-Api-Key | string · header | Required | Your App Key. |
X-Timestamp | string · header | Required | Request timestamp in seconds (Unix epoch). |
X-Api-Signature | string · header | Required | HMAC-SHA256 signature. Format: HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=. |
This API is used to replace order, modify quantity or price.
# Replace the order ID below with your actual order ID
longbridge order replace 693664675163312128 --qty 200 --price 255.00
Request
Request body
| Name | Type | Required | Description |
|---|---|---|---|
order_id | string | Required | Order ID |
quantity | string | Required | Replaced quantity, example: `100` |
price | string | Optional | Replaced price, example: `388.5`. `LO` / `ELO` / `ALO` / `ODD` / `LIT` Order Required |
trigger_price | string | Optional | Trigger price, example: `388.5`. `LIT` / `MIT` Order Required |
limit_offset | string | Optional | Limit offset amount. `TSLPAMT` / `TSLPPCT` Order Required when`limit_depth_level` is set to 0 |
trailing_amount | string | Optional | Trailing amount. `TSLPAMT` Order Required |
trailing_percent | string | Optional | Trailing percent. `TSLPPCT` Order Required |
remark | string | Optional | Remark (Maximum 64 characters) |
limit_depth_level | integer | Optional | Specifies the bid/ask depth level. `TSLPAMT` / `TSLPPCT` Order Required |
monitor_price | string | Optional | Monitoring price. `TSLPAMT` / `TSLPPCT` Order Required |
trigger_count | integer | Optional | Number of triggers. `LIT` / `MIT` / `TSLPAMT` / `TSLPPCT` Order Required |
attached_params | object | Optional | Attached order parameters (take-profit / stop-loss) |
attached_params.attached_order_type | string | Optional | Attached order type. **Enum Value:**, `PROFIT_TAKER` - Take Profit, `STOP_LOSS` - Stop Loss, `BRACKET` - Bracket Order |
attached_params.profit_taker_price | string | Optional | Take-profit trigger price |
attached_params.stop_loss_price | string | Optional | Stop-loss trigger price |
attached_params.time_in_force | string | Optional | Attached order time in force type. **Enum Value:**, `Day` - Day Order, `GTC` - Good Til Canceled Order, `GTD` - Good Til Date Order (inherits the main order's `expire_date` in this case) |
attached_params.expire_time | integer | Optional | Expire time (Unix timestamp, in seconds) |
attached_params.profit_taker_id | integer | Optional | Take-profit order ID, fill in when modifying an existing take-profit order |
attached_params.stop_loss_id | integer | Optional | Stop-loss order ID, fill in when modifying an existing stop-loss order |
attached_params.cancel_all_attached | boolean | Optional | Whether to cancel all attached orders |
attached_params.main_id | integer | Optional | Main order ID |
attached_params.quantity | string | Optional | Attached order quantity |
attached_params.market_price | string | Optional | Market price |
attached_params.activate_order_type | string | Optional | Order type submitted after triggering, e.g. `LIT` (limit-if-touched) or `MIT` (market-if-touched) |
attached_params.profit_taker_submit_price | string | Optional | Take-profit limit order submitted price, required when `activate_order_type` is `LIT` |
attached_params.stop_loss_submit_price | string | Optional | Stop-loss limit order submitted price, required when `activate_order_type` is `LIT` |
attached_params.activate_rth | string | Optional | Whether the order submitted after triggering allows pre/post market trading. **Enum Value:**, `RTH_ONLY` - Regular trading hours only, `ANY_TIME` - Any time |
attached_params.profit_taker_depth_level | integer | Optional | Specifies the bid/ask depth level for the take-profit limit order submitted price, valid when `activate_order_type` is `LIT` |
attached_params.stop_loss_depth_level | integer | Optional | Specifies the bid/ask depth level for the stop-loss limit order submitted price, valid when `activate_order_type` is `LIT` |
Response
Response JSON example
{
"code": 0,
"message": "success",
"data": {}
}Error code
See the Error Codes page for the full list of error codes.