Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"editor.formatOnSave": true,
"autocorrect.enable": true,
"autocorrect.formatOnSave": true,
"[markdown]": {
Expand Down
49 changes: 48 additions & 1 deletion docs/en/docs/trade/order/history_orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,32 @@ func main() {
"remark": "",
"limit_depth_level": 0,
"monitor_price": "",
"trigger_count": 1
"trigger_count": 1,
"attached_orders": [
{
"order_id": "706388312699592705",
"attached_type_display": 2,
"trigger_price": "10.500",
"quantity": "200",
"executed_qty": "0",
"status": "NewStatus",
"updated_at": "1651644898",
"withdrawn": false,
"gtd": "",
"time_in_force": "Day",
"counter_id": "",
"trigger_status": 0,
"executed_amount": "0",
"tag": 0,
"submitted_at": "1651644897",
"executed_price": "0.000",
"force_only_rth": "RTH_ONLY",
"reviewed": false,
"activate_order_type": "MIT",
"activate_rth": "RTH_ONLY",
"submit_price": ""
}
]
}
]
}
Expand Down Expand Up @@ -340,3 +365,25 @@ func main() {
| ∟ limit_depth_level | int32 | true | Specifies the bid/ask depth level |
| ∟ monitor_price | string | true | Monitoring price |
| ∟ trigger_count | int32 | true | Number of triggers |
| ∟ attached_orders | object[] | false | List of attached order details |
| ∟∟ order_id | string | true | Attached order ID |
| ∟∟ attached_type_display | int32 | true | Attached order type.<br/><br/> **Enum Value:**<br/> `1` - Take Profit<br/> `2` - Stop Loss |
| ∟∟ trigger_price | string | true | Trigger price |
| ∟∟ quantity | string | true | Order quantity |
| ∟∟ executed_qty | string | true | Executed quantity |
| ∟∟ status | string | true | Order status |
| ∟∟ updated_at | string | true | Last updated time, formatted as a timestamp (second) |
| ∟∟ withdrawn | boolean | true | Whether the order has been withdrawn |
| ∟∟ gtd | string | true | GTD expiration date, format: `YYYY-MM-DD` |
| ∟∟ time_in_force | string | true | Time in force Type<br/><br/> **Enum Value:**<br/> `Day` - Day Order<br/> `GTC` - Good Til Canceled Order<br/> `GTD` - Good Til Date Order |
| ∟∟ counter_id | string | true | Counter order ID |
| ∟∟ trigger_status | int32 | true | Conditional order trigger status after the attached order is activated.<br/> `0` - Not activated<br/> `1` - Monitoring<br/> `2` - Cancelled<br/> `4` - Triggered |
| ∟∟ executed_amount | string | true | Executed amount |
| ∟∟ tag | int32 | true | Order tag |
| ∟∟ submitted_at | string | true | Submitted time, formatted as a timestamp (second) |
| ∟∟ executed_price | string | true | Executed price |
| ∟∟ force_only_rth | string | true | Whether execution is restricted to regular trading hours only |
| ∟∟ reviewed | boolean | true | Whether the order has been reviewed|
| ∟∟ activate_order_type | string | true | Order type submitted after triggering, e.g. `LIT` (limit-if-touched) or `MIT` (market-if-touched) |
| ∟∟ activate_rth | string | true | Whether the order submitted after triggering allows pre/post market trading |
| ∟∟ submit_price | string | true | Submitted price |
64 changes: 57 additions & 7 deletions docs/en/docs/trade/order/order_detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ longbridge order detail 693664675163312128

> Content-Type: application/json; charset=utf-8

| Name | Type | Required | Description |
| -------- | ------ | -------- | ------------------------------------------------------------------------- |
| order_id | string | YES | Order ID for specifying order ID query, for example: `701276261045858304` |
| Name | Type | Required | Description |
| ----------- | ------ | -------- | ------------------------------------------------------------------------- |
| order_id | string | YES | Order ID for specifying order ID query, for example: `701276261045858304` |
| is_attached | bool | NO | Whether `order_id` refers to an attached order |

### Request Example

Expand All @@ -50,6 +51,7 @@ ctx = TradeContext(config)

resp = ctx.order_detail(
order_id = "701276261045858304",
is_attached = False,
)
print(resp)
```
Expand All @@ -68,6 +70,7 @@ async def main() -> None:

resp = await ctx.order_detail(
order_id = "701276261045858304",
is_attached = False,
)
print(resp)

Expand Down Expand Up @@ -303,7 +306,32 @@ func main() {
],
"total_amount": "0",
"currency": "USD"
}
},
"attached_orders": [
{
"order_id": "706388312699592705",
"attached_type_display": 2,
"trigger_price": "10.500",
"quantity": "200",
"executed_qty": "0",
"status": "NewStatus",
"updated_at": "1651644898",
"withdrawn": false,
"gtd": "",
"time_in_force": "Day",
"counter_id": "",
"trigger_status": 0,
"executed_amount": "0",
"tag": 0,
"submitted_at": "1651644897",
"executed_price": "0.000",
"force_only_rth": "RTH_ONLY",
"reviewed": false,
"activate_order_type": "MIT",
"activate_rth": "RTH_ONLY",
"submit_price": ""
}
]
}
}
```
Expand Down Expand Up @@ -381,6 +409,28 @@ Order Information
| ∟∟∟ name | string | true | Charge name |
| ∟∟∟ amount | string | true | Charge amount |
| ∟∟∟ currency | string | true | Charge currency |
| ∟∟∟ limit_depth_level | int32 | true | Specifies the bid/ask depth level |
| ∟∟∟ monitor_price | string | true | Monitoring price |
| ∟∟∟ trigger_count | int32 | true | Number of triggers |
| ∟ limit_depth_level | int32 | true | Specifies the bid/ask depth level |
| ∟ monitor_price | string | true | Monitoring price |
| ∟ trigger_count | int32 | true | Number of triggers |
| ∟ attached_orders | object[] | false | List of attached order details |
| ∟∟ order_id | string | true | Attached order ID |
| ∟∟ attached_type_display | int32 | true | Attached order type.<br/><br/> **Enum Value:**<br/> `1` - Take Profit<br/> `2` - Stop Loss |
| ∟∟ trigger_price | string | true | Trigger price |
| ∟∟ quantity | string | true | Order quantity |
| ∟∟ executed_qty | string | true | Executed quantity |
| ∟∟ status | string | true | Order status |
| ∟∟ updated_at | string | true | Last updated time, formatted as a timestamp (second) |
| ∟∟ withdrawn | boolean | true | Whether the order has been withdrawn |
| ∟∟ gtd | string | true | GTD expiration date, format: `YYYY-MM-DD` |
| ∟∟ time_in_force | string | true | Time in force Type<br/><br/> **Enum Value:**<br/> `Day` - Day Order<br/> `GTC` - Good Til Canceled Order<br/> `GTD` - Good Til Date Order |
| ∟∟ counter_id | string | true | Counter order ID |
| ∟∟ trigger_status | int32 | true | Conditional order trigger status after the attached order is activated.<br/> `0` - Not activated<br/> `1` - Monitoring<br/> `2` - Cancelled<br/> `4` - Triggered |
| ∟∟ executed_amount | string | true | Executed amount |
| ∟∟ tag | int32 | true | Order tag |
| ∟∟ submitted_at | string | true | Submitted time, formatted as a timestamp (second) |
| ∟∟ executed_price | string | true | Executed price |
| ∟∟ force_only_rth | string | true | Whether execution is restricted to regular trading hours only |
| ∟∟ reviewed | boolean | true | Whether the order has been reviewed |
| ∟∟ activate_order_type | string | true | Order type submitted after triggering, e.g. `LIT` (limit-if-touched) or `MIT` (market-if-touched) |
| ∟∟ activate_rth | string | true | Whether the order submitted after triggering allows pre/post market trading |
| ∟∟ submit_price | string | true | Submitted price |
16 changes: 16 additions & 0 deletions docs/en/docs/trade/order/replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ longbridge order replace 693664675163312128 --qty 200 --price 255.00
| limit_depth_level | int32 | NO | Specifies the bid/ask depth level. `TSLPAMT` / `TSLPPCT` Order Required |
| monitor_price | string | NO | Monitoring price. `TSLPAMT` / `TSLPPCT` Order Required |
| trigger_count | int32 | 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<br/><br/>**Enum Value:**<br/>`PROFIT_TAKER` - Take Profit<br/>`STOP_LOSS` - Stop Loss<br/>`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<br/><br/>**Enum Value:**<br/>`Day` - Day Order<br/> `GTC` - Good Til Canceled Order<br/> `GTD` - Good Til Date Order (inherits the main order's `expire_date` in this case) |
| attached_params.expire_time | int64 | NO | Expire time (Unix timestamp, in seconds) |
| attached_params.profit_taker_id | int64 | NO | Take-profit order ID, fill in when modifying an existing take-profit order |
| attached_params.stop_loss_id | int64 | NO | Stop-loss order ID, fill in when modifying an existing stop-loss order |
| attached_params.cancel_all_attached | bool | NO | Whether to cancel all attached orders |
| attached_params.main_id | int64 | 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<br/><br/>**Enum Value:**<br/> `RTH_ONLY` - Regular trading hours only<br/> `ANY_TIME` - Any time |

### Request Example

Expand Down
10 changes: 10 additions & 0 deletions docs/en/docs/trade/order/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ longbridge order sell TSLA.US 100 --price 260.00
| monitor_price | string | NO | Monitoring price. <br/>Monitoring starts only after reaching this price, updating the reference price.<br/>Valid for `TSLPAMT` / `TSLPPCT` orders. |
| trigger_count | int32 | NO | Number of triggers. Value range is 0 ~ 3.<br/>Specifies that within 1 minute, the order will only be placed after being triggered multiple times.<br/>Valid for `LIT` / `MIT` / `TSLPAMT` / `TSLPPCT` orders. |
| client_request_id | string | NO | Idempotent request ID for preventing duplicate order submissions. The server caches this request ID for 10 minutes. If a request with the same ID is received within this period, it returns the same response without creating a duplicate order. Must be a unique identifier (e.g., UUID). |
| attached_params | object | NO | Attached order parameters (take-profit / stop-loss) |
| attached_params.attached_order_type | string | NO | Attached order type<br/><br/>**Enum Value:**<br/>`PROFIT_TAKER` - Take Profit<br/>`STOP_LOSS` - Stop Loss<br/>`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<br/><br/>**Enum Value:**<br/>`Day` - Day Order<br/> `GTC` - Good Til Canceled Order<br/> `GTD` - Good Til Date Order (inherits the main order's `expire_date` in this case) |
| attached_params.expire_time | int64 | NO | Expire time (Unix timestamp, in seconds) |
| 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 <br/><br/>**Enum Value:**<br/> `RTH_ONLY` - Regular trading hours only<br/> `ANY_TIME` - Any time |

### Idempotency

Expand Down
Loading
Loading