# Replace Order

`PUT` `/v1/trade/order`

This API is used to replace order, modify quantity or price.

## Parameters

### Request Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `order_id` | string | Yes | Order ID |
| `quantity` | string | Yes | Replaced quantity, example: `100` |
| `price` | string | No | Replaced price, example: `388.5`. `LO` / `ELO` / `ALO` / `ODD` / `LIT` Order Required |
| `trigger_price` | string | No | Trigger price, example: `388.5`. `LIT` / `MIT` Order Required |
| `limit_offset` | string | No | Limit offset amount. `TSLPAMT` / `TSLPPCT` Order Required when`limit_depth_level` is set to 0 |
| `trailing_amount` | string | No | Trailing amount. `TSLPAMT` Order Required |
| `trailing_percent` | string | No | Trailing percent. `TSLPPCT` Order Required |
| `remark` | string | No | Remark (Maximum 64 characters) |
| `limit_depth_level` | integer | No | Specifies the bid/ask depth level. `TSLPAMT` / `TSLPPCT` Order Required |
| `monitor_price` | string | No | Monitoring price. `TSLPAMT` / `TSLPPCT` Order Required |
| `trigger_count` | integer | No | Number of triggers. `LIT` / `MIT` / `TSLPAMT` / `TSLPPCT` Order Required |
| `attached_params` | object | No | Attached order parameters (take-profit / stop-loss) |
| `attached_params.attached_order_type` | string | No | Attached order type. **Enum Value:**, `PROFIT_TAKER` - Take Profit, `STOP_LOSS` - Stop Loss, `BRACKET` - Bracket Order |
| `attached_params.profit_taker_price` | string | No | Take-profit trigger price |
| `attached_params.stop_loss_price` | string | No | Stop-loss trigger price |
| `attached_params.time_in_force` | string | No | 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 | No | Expire time (Unix timestamp, in seconds) |
| `attached_params.profit_taker_id` | integer | No | Take-profit order ID, fill in when modifying an existing take-profit order |
| `attached_params.stop_loss_id` | integer | No | Stop-loss order ID, fill in when modifying an existing stop-loss order |
| `attached_params.cancel_all_attached` | boolean | No | Whether to cancel all attached orders |
| `attached_params.main_id` | integer | No | Main order ID |
| `attached_params.quantity` | string | No | Attached order quantity |
| `attached_params.market_price` | string | No | Market price |
| `attached_params.activate_order_type` | string | No | Order type submitted after triggering, e.g. `LIT` (limit-if-touched) or `MIT` (market-if-touched) |
| `attached_params.profit_taker_submit_price` | string | No | Take-profit limit order submitted price, required when `activate_order_type` is `LIT` |
| `attached_params.stop_loss_submit_price` | string | No | Stop-loss limit order submitted price, required when `activate_order_type` is `LIT` |
| `attached_params.activate_rth` | string | No | 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 | No | 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 | No | Specifies the bid/ask depth level for the stop-loss limit order submitted price, valid when `activate_order_type` is `LIT` |

## Request Example

```bash
curl --request PUT \
  --url 'https://openapi.longbridge.com/v1/trade/order' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{"order_id":"<order_id>","quantity":"<quantity>","price":"<price>","trigger_price":"<trigger_price>","limit_offset":"<limit_offset>","trailing_amount":"<trailing_amount>","trailing_percent":"<trailing_percent>","remark":"<remark>","limit_depth_level":0,"monitor_price":"<monitor_price>","trigger_count":0,"attached_params":{"attached_order_type":"<attached_order_type>","profit_taker_price":"<profit_taker_price>","stop_loss_price":"<stop_loss_price>","time_in_force":"<time_in_force>","expire_time":0,"profit_taker_id":0,"stop_loss_id":0,"cancel_all_attached":false,"main_id":0,"quantity":"<quantity>","market_price":"<market_price>","activate_order_type":"<activate_order_type>","profit_taker_submit_price":"<profit_taker_submit_price>","stop_loss_submit_price":"<stop_loss_submit_price>","activate_rth":"<activate_rth>"}}'
```

## Response

### Response JSON Example

```json
{
  "code": 0,
  "message": "success",
  "data": {}
}
```
