From 6b9448cf2a1d91622eccc35b1b1c0c9ec628c417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=9F=B3=E7=85=9C?= Date: Mon, 29 Jun 2026 17:15:43 +0800 Subject: [PATCH 1/7] docs(trade): add OPTION_PRE_MARKET enum to outside_rth in submit order --- docs/en/docs/trade/order/submit.md | 2 +- docs/zh-CN/docs/trade/order/submit.md | 2 +- docs/zh-HK/docs/trade/order/submit.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/docs/trade/order/submit.md b/docs/en/docs/trade/order/submit.md index b08e642da..72e6f9ba1 100644 --- a/docs/en/docs/trade/order/submit.md +++ b/docs/en/docs/trade/order/submit.md @@ -44,7 +44,7 @@ longbridge order sell TSLA.US 100 --price 260.00 | trailing_percent | string | NO | Trailing percent

`TSLPPCT` Order Required | | expire_date | string | NO | Long term order expire date, format `YYYY-MM-DD`, example: `2022-12-05`

Required when `time_in_force` is `GTD` | | side | string | YES | Order Side

**Enum Value:**
`Buy`
`Sell` | -| outside_rth | string | NO | Enable or disable outside regular trading hours

**Enum Value:**
`RTH_ONLY` - regular trading hour only
`ANY_TIME` - any time
`OVERNIGHT` - Overnight | +| outside_rth | string | NO | Enable or disable outside regular trading hours

**Enum Value:**
`RTH_ONLY` - regular trading hour only
`ANY_TIME` - any time
`OVERNIGHT` - Overnight
`OPTION_PRE_MARKET` - Overnight option | | time_in_force | string | YES | Time in force Type

**Enum Value:**
`Day` - Day Order
`GTC` - Good Til Canceled Order
`GTD` - Good Til Date Order | | remark | string | NO | remark (Maximum 255 characters) | | limit_depth_level | int32 | NO | Specifies the bid/ask depth level. Value range is -5 ~ 0 ~ 5.
Negative numbers indicate bid levels (e.g., -1 means best bid level 1),
positive numbers indicate ask levels (e.g., 1 means best ask level 1).
When set to 0, the `limit_offset` parameter takes effect.
Valid for `TSLPAMT` / `TSLPPCT` orders. | diff --git a/docs/zh-CN/docs/trade/order/submit.md b/docs/zh-CN/docs/trade/order/submit.md index 56fe84bfa..4db734844 100644 --- a/docs/zh-CN/docs/trade/order/submit.md +++ b/docs/zh-CN/docs/trade/order/submit.md @@ -40,7 +40,7 @@ longbridge order sell TSLA.US 100 --price 260.00 | trailing_percent | string | NO | 跟踪涨跌幅,单位为百分比,例如 "2.5" 表示 "2.5%"

`TSLPPCT` 订单必填 | | expire_date | string | NO | 长期单过期时间,格式为 `YYYY-MM-DD`, 例如:`2022-12-05`

time_in_force 为 `GTD` 时必填 | | side | string | YES | 买卖方向

**可选值:**
`Buy` - 买入
`Sell` - 卖出 | -| outside_rth | string | NO | 是否允许盘前盘后,美股必填

**可选值:**
`RTH_ONLY` - 不允许盘前盘后
`ANY_TIME` - 允许盘前盘后
`OVERNIGHT` - 夜盘 | +| outside_rth | string | NO | 是否允许盘前盘后,美股必填

**可选值:**
`RTH_ONLY` - 不允许盘前盘后
`ANY_TIME` - 允许盘前盘后
`OVERNIGHT` - 夜盘
`OPTION_PRE_MARKET` - 夜盘期权 | | time_in_force | string | YES | 订单有效期类型

**可选值:**
`Day` - 当日有效
`GTC` - 撤单前有效
`GTD` - 到期前有效 | | remark | string | NO | 备注 (最大 64 字符) | | limit_depth_level | int32 | NO | 指定买卖档位,取值范围为 -5 ~ 0 ~ 5,负数代表买盘档位(如 -1 表示买一),
正数代表卖盘档位(如 1 表示卖一),为 0 时 limit_offset 参数生效
`TSLPAMT` / `TSLPPCT` 订单有效 | diff --git a/docs/zh-HK/docs/trade/order/submit.md b/docs/zh-HK/docs/trade/order/submit.md index 89537bca3..55fac1b60 100644 --- a/docs/zh-HK/docs/trade/order/submit.md +++ b/docs/zh-HK/docs/trade/order/submit.md @@ -44,7 +44,7 @@ longbridge order sell TSLA.US 100 --price 260.00 | trailing_percent | string | NO | 跟蹤漲跌幅

`TSLPPCT` 訂單必填 | | expire_date | string | NO | 長期單過期時間,格式為 `YYYY-MM-DD`, 例如:`2022-12-05`

time_in_force 為 `GTD` 時必填 | | side | string | YES | 買賣方向

**可選值:**
`Buy` - 買入
`Sell` - 賣出 | -| outside_rth | string | NO | 是否允許盤前盤後,美股必填

**可選值:**
`RTH_ONLY` - 不允許盤前盤後
`ANY_TIME` - 允許盤前盤後
`OVERNIGHT` - 夜盤 | +| outside_rth | string | NO | 是否允許盤前盤後,美股必填

**可選值:**
`RTH_ONLY` - 不允許盤前盤後
`ANY_TIME` - 允許盤前盤後
`OVERNIGHT` - 夜盤
`OPTION_PRE_MARKET` - 夜盤期權 | | time_in_force | string | YES | 訂單有效期類型

**可選值:**
`Day` - 當日有效
`GTC` - 撤單前有效
`GTD` - 到期前有效 | | remark | string | NO | 備註 (最大 64 字符) | | limit_depth_level | int32 | NO | 指定買賣檔位,取值範圍為 -5 ~ 0 ~ 5,負數代表買盤檔位(例如 -1 表示買一),
正數代表賣盤檔位(例如 1 表示賣一),當為 0 時 limit_offset 參數生效
`TSLPAMT` / `TSLPPCT` 訂單有效 | From 8412b94b179ace2d579d6604cef4a7ee6d30fce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=9F=B3=E7=85=9C?= Date: Fri, 3 Jul 2026 16:26:57 +0800 Subject: [PATCH 2/7] docs(trade): add AllDeals API --- .../en/docs/trade/execution/all_executions.md | 96 +++++++++++++++++++ docs/en/docs/trade/overview.md | 5 +- .../docs/trade/execution/all_executions.md | 96 +++++++++++++++++++ docs/zh-CN/docs/trade/overview.md | 5 +- .../docs/trade/execution/all_executions.md | 96 +++++++++++++++++++ docs/zh-HK/docs/trade/overview.md | 5 +- 6 files changed, 300 insertions(+), 3 deletions(-) create mode 100644 docs/en/docs/trade/execution/all_executions.md create mode 100644 docs/zh-CN/docs/trade/execution/all_executions.md create mode 100644 docs/zh-HK/docs/trade/execution/all_executions.md diff --git a/docs/en/docs/trade/execution/all_executions.md b/docs/en/docs/trade/execution/all_executions.md new file mode 100644 index 000000000..cb5e38e91 --- /dev/null +++ b/docs/en/docs/trade/execution/all_executions.md @@ -0,0 +1,96 @@ +--- +slug: all_executions +sidebar_position: 3 +title: All Executions +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +This API is used to query execution (fill) records, including both buy and sell records. It supports querying today's and historical executions at the same time. Compared with the today/history execution APIs, each record additionally returns the trade `side`. + + + +## Request + + + + + + +
HTTP MethodGET
HTTP URL/v3/trade/execution/all
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| -------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| symbol | string | NO | Stock symbol, use `ticker.region` format, example: `AAPL.US` | +| order_id | string | NO | Order ID, example: `701276261045858304` | +| start_at | string | NO | Start time, formatted as a timestamp (second), example: `1650410999`.

If the start time is null, the default is the 90 days before of the end time or 90 days before of the current time. | +| end_at | string | NO | End time, formatted as a timestamp (second), example: `1650410999`.

If the end time is null, the default is the current time or 90 days after of the start time. | +| page | string | NO | Page number, starting from `1`. The maximum number of records per query is 1000. If the number of results exceeds 1000, `has_more` will be `true`, use `page` together with `has_more` to paginate. | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "has_more": false, + "trades": [ + { + "order_id": "693664675163312128", + "price": "388", + "quantity": "100", + "symbol": "700.HK", + "trade_done_at": "1648611351", + "trade_id": "693664675163312128-1648611351433741210", + "side": "Buy" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | -------------------------------------------------------- | ----------------------------------------------- | +| 200 | Get All Executions Success | [all_executions_rsp](#schemaall_executions_rsp) | +| 400 | The query failed with an error in the request parameter. | None | + + + +## Schemas + +### all_executions_rsp + + + + +| Name | Type | Required | Description | +| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| has_more | boolean | true | has more orders record.

The maximum number of orders per query is 1000, if the number of results exceeds 1000, then has_more will be true | +| trades | object[] | false | Execution Detail | +| ∟ order_id | string | true | Order ID | +| ∟ trade_id | string | true | Execution ID | +| ∟ symbol | string | true | Stock symbol, use `ticker.region` format,example: `AAPL.US` | +| ∟ trade_done_at | string | true | Trade done time, formatted as a timestamp (second) | +| ∟ quantity | string | true | Executed quantity | +| ∟ price | string | true | Executed price | +| ∟ side | string | true | Trade side

**Enum Value:**
`Buy`
`Sell` | diff --git a/docs/en/docs/trade/overview.md b/docs/en/docs/trade/overview.md index 83db47ff1..94543b21b 100644 --- a/docs/en/docs/trade/overview.md +++ b/docs/en/docs/trade/overview.md @@ -16,7 +16,7 @@ sidebar_position: 1 - Trade + Trade Submit Order @@ -37,6 +37,9 @@ sidebar_position: 1 Get History Executions + + Get All Executions + Asset Get Account Balance diff --git a/docs/zh-CN/docs/trade/execution/all_executions.md b/docs/zh-CN/docs/trade/execution/all_executions.md new file mode 100644 index 000000000..23c248df6 --- /dev/null +++ b/docs/zh-CN/docs/trade/execution/all_executions.md @@ -0,0 +1,96 @@ +--- +slug: all_executions +sidebar_position: 3 +title: 全部成交明细 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +该接口用于获取订单的成交明细,包括买入和卖出的成交记录,同时支持当日成交和历史成交查询。相比当日/历史成交接口,每条记录额外返回买卖方向 `side`。 + + + +## Request + + + + + + +
HTTP MethodGET
HTTP URL/v3/trade/execution/all
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| -------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------- | +| symbol | string | NO | 股票代码,使用 `ticker.region` 格式,例如:`AAPL.US` | +| order_id | string | NO | 订单 ID,例如:`701276261045858304` | +| start_at | string | NO | 开始时间,格式为时间戳 (秒),例如:`1650410999`。

开始时间为空时,默认为结束时间或当前时间前九十天。 | +| end_at | string | NO | 结束时间,格式为时间戳 (秒),例如:`1650410999`。

结束时间为空时,默认为开始时间后九十天或当前时间。 | +| page | string | NO | 页码,从 `1` 开始。单次查询最多返回 1000 条记录,若结果超过 1000 条,`has_more` 为 `true`,可结合 `has_more` 翻页。 | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "has_more": false, + "trades": [ + { + "order_id": "693664675163312128", + "price": "388", + "quantity": "100", + "symbol": "700.HK", + "trade_done_at": "1648611351", + "trade_id": "693664675163312128-1648611351433741210", + "side": "Buy" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ------------------ | ----------------------------------------------- | +| 200 | 获取全部成交明细成功 | [all_executions_rsp](#schemaall_executions_rsp) | +| 400 | 请求参数有误,查询失败 | None | + + + +## Schemas + +### all_executions_rsp + + + + +| Name | Type | Required | Description | +| --------------- | -------- | -------- | --------------------------------------------------------------------- | +| has_more | boolean | true | 是否有更多记录。

单次查询最多返回 1000 条记录,若结果超过 1000 条,has_more 为 true | +| trades | object[] | false | 成交明细 | +| ∟ order_id | string | true | 订单 ID | +| ∟ trade_id | string | true | 成交 ID | +| ∟ symbol | string | true | 股票代码,使用 `ticker.region` 格式,例如:`AAPL.US` | +| ∟ trade_done_at | string | true | 成交时间,格式为时间戳 (秒) | +| ∟ quantity | string | true | 成交数量 | +| ∟ price | string | true | 成交价格 | +| ∟ side | string | true | 买卖方向

**可选值:**
`Buy` - 买入
`Sell` - 卖出 | diff --git a/docs/zh-CN/docs/trade/overview.md b/docs/zh-CN/docs/trade/overview.md index 60232a1bf..ff2710671 100644 --- a/docs/zh-CN/docs/trade/overview.md +++ b/docs/zh-CN/docs/trade/overview.md @@ -17,7 +17,7 @@ sidebar_position: 1 - 交易 + 交易 委托下单 @@ -38,6 +38,9 @@ sidebar_position: 1 获取历史成交明细 + + 获取全部成交明细 + 资产 获取账户资金信息 diff --git a/docs/zh-HK/docs/trade/execution/all_executions.md b/docs/zh-HK/docs/trade/execution/all_executions.md new file mode 100644 index 000000000..d5ed53b48 --- /dev/null +++ b/docs/zh-HK/docs/trade/execution/all_executions.md @@ -0,0 +1,96 @@ +--- +slug: all_executions +sidebar_position: 3 +title: 全部成交明細 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +該接口用於獲取訂單的成交明細,包括買入和賣出的成交記錄,同時支持當日成交和歷史成交查詢。相比當日/歷史成交接口,每條記錄額外返回買賣方向 `side`。 + + + +## Request + + + + + + +
HTTP MethodGET
HTTP URL/v3/trade/execution/all
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| -------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------- | +| symbol | string | NO | 股票代碼,使用 `ticker.region` 格式,例如:`AAPL.US` | +| order_id | string | NO | 訂單 ID,例如:`701276261045858304` | +| start_at | string | NO | 開始時間,格式為時間戳 (秒),例如:`1650410999`。

開始時間為空時,默認為結束時間或當前時間前九十天。 | +| end_at | string | NO | 結束時間,格式為時間戳 (秒),例如:`1650410999`。

結束時間為空時,默認為開始時間後九十天或當前時間。 | +| page | string | NO | 頁碼,從 `1` 開始。單次查詢最多返回 1000 條記錄,若結果超過 1000 條,`has_more` 為 `true`,可結合 `has_more` 翻頁。 | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "has_more": false, + "trades": [ + { + "order_id": "693664675163312128", + "price": "388", + "quantity": "100", + "symbol": "700.HK", + "trade_done_at": "1648611351", + "trade_id": "693664675163312128-1648611351433741210", + "side": "Buy" + } + ] + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ------------------ | ----------------------------------------------- | +| 200 | 獲取全部成交明細成功 | [all_executions_rsp](#schemaall_executions_rsp) | +| 400 | 請求參數有誤,查詢失敗 | None | + + + +## Schemas + +### all_executions_rsp + + + + +| Name | Type | Required | Description | +| --------------- | -------- | -------- | --------------------------------------------------------------------- | +| has_more | boolean | true | 是否有更多記錄。

單次查詢最多返回 1000 條記錄,若結果超過 1000 條,has_more 為 true | +| trades | object[] | false | 成交明細 | +| ∟ order_id | string | true | 訂單 ID | +| ∟ trade_id | string | true | 成交 ID | +| ∟ symbol | string | true | 股票代碼,使用 `ticker.region` 格式,例如:`AAPL.US` | +| ∟ trade_done_at | string | true | 成交時間,格式為時間戳 (秒) | +| ∟ quantity | string | true | 成交數量 | +| ∟ price | string | true | 成交價格 | +| ∟ side | string | true | 買賣方向

**可選值:**
`Buy` - 買入
`Sell` - 賣出 | diff --git a/docs/zh-HK/docs/trade/overview.md b/docs/zh-HK/docs/trade/overview.md index b9a084deb..3b2d12ee2 100644 --- a/docs/zh-HK/docs/trade/overview.md +++ b/docs/zh-HK/docs/trade/overview.md @@ -17,7 +17,7 @@ sidebar_position: 1 - 交易 + 交易 委托下單 @@ -38,6 +38,9 @@ sidebar_position: 1 獲取曆史成交明細 + + 獲取全部成交明細 + 資產 獲取賬戶資金信息 From 10edf126bb7df2458d77a68fff20df3aafdc082b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=9F=B3=E7=85=9C?= Date: Fri, 3 Jul 2026 17:59:29 +0800 Subject: [PATCH 3/7] docs(trade): add multi-leg option order docs --- docs/en/docs/trade/order/history_orders.md | 44 +++++++++++- docs/en/docs/trade/order/order_detail.md | 42 +++++++++++ docs/en/docs/trade/order/submit_multileg.md | 71 +++++++++++++++++++ docs/en/docs/trade/order/today_orders.md | 44 +++++++++++- docs/en/docs/trade/overview.md | 5 +- docs/zh-CN/docs/trade/order/history_orders.md | 44 +++++++++++- docs/zh-CN/docs/trade/order/order_detail.md | 42 +++++++++++ .../zh-CN/docs/trade/order/submit_multileg.md | 71 +++++++++++++++++++ docs/zh-CN/docs/trade/order/today_orders.md | 44 +++++++++++- docs/zh-CN/docs/trade/overview.md | 5 +- docs/zh-HK/docs/trade/order/history_orders.md | 44 +++++++++++- docs/zh-HK/docs/trade/order/order_detail.md | 42 +++++++++++ .../zh-HK/docs/trade/order/submit_multileg.md | 71 +++++++++++++++++++ docs/zh-HK/docs/trade/order/today_orders.md | 44 +++++++++++- docs/zh-HK/docs/trade/overview.md | 5 +- 15 files changed, 609 insertions(+), 9 deletions(-) create mode 100644 docs/en/docs/trade/order/submit_multileg.md create mode 100644 docs/zh-CN/docs/trade/order/submit_multileg.md create mode 100644 docs/zh-HK/docs/trade/order/submit_multileg.md diff --git a/docs/en/docs/trade/order/history_orders.md b/docs/en/docs/trade/order/history_orders.md index 77f8ccdba..c54e1b392 100644 --- a/docs/en/docs/trade/order/history_orders.md +++ b/docs/en/docs/trade/order/history_orders.md @@ -283,7 +283,35 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1 + "trigger_count": 1, + "multi_leg": { + "strategy": 2, + "strategy_name": "Vertical spread", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 Vertical spread", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -340,3 +368,17 @@ 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 | +| ∟ multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | +| ∟∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | +| ∟∟ strategy_name | string | false | Strategy name | +| ∟∟ multileg_id | string | false | Multi-leg combination ID | +| ∟∟ code | string | false | Multi-leg combination code | +| ∟∟ legs | object[] | false | Legs of the combination order | +| ∟∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | +| ∟∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | Leg ratio quantity | +| ∟∟∟ strike_price | string | false | Strike price | +| ∟∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | +| ∟∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/order/order_detail.md b/docs/en/docs/trade/order/order_detail.md index 31eda2c5a..9177a003e 100644 --- a/docs/en/docs/trade/order/order_detail.md +++ b/docs/en/docs/trade/order/order_detail.md @@ -303,6 +303,34 @@ func main() { ], "total_amount": "0", "currency": "USD" + }, + "multi_leg": { + "strategy": 2, + "strategy_name": "Vertical spread", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 Vertical spread", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] } } } @@ -384,3 +412,17 @@ Order Information | ∟∟∟ limit_depth_level | int32 | true | Specifies the bid/ask depth level | | ∟∟∟ monitor_price | string | true | Monitoring price | | ∟∟∟ trigger_count | int32 | true | Number of triggers | +| multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | +| ∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | +| ∟ strategy_name | string | false | Strategy name | +| ∟ multileg_id | string | false | Multi-leg combination ID | +| ∟ code | string | false | Multi-leg combination code | +| ∟ legs | object[] | false | Legs of the combination order | +| ∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | +| ∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | +| ∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | +| ∟∟ ratio_quantity | string | false | Leg ratio quantity | +| ∟∟ strike_price | string | false | Strike price | +| ∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | +| ∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | +| ∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/order/submit_multileg.md b/docs/en/docs/trade/order/submit_multileg.md new file mode 100644 index 000000000..26b82a38c --- /dev/null +++ b/docs/en/docs/trade/order/submit_multileg.md @@ -0,0 +1,71 @@ +--- +slug: submit_multileg +sidebar_position: 8 +title: Submit Multi-leg Order +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +This API is used to submit a multi-leg option combination order (such as vertical spreads, straddles, strangles, collars, etc.). All legs are submitted together as a single strategy order. + + + +## Request + + + + + + +
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| side | string | YES | Order Side

**Enum Value:**
`Buy`
`Sell` | +| order_type | string | YES | [Order Type](../trade-definition#ordertype) | +| submitted_price | string | NO | Submitted price, example: `1.5`

Required for limit order types such as `LO` | +| submitted_quantity | string | YES | Submitted quantity (number of combinations), example: `1` | +| strategy | string | YES | Multi-leg strategy

**Enum Value:**
`CoveredCall` - Covered stock
`CoveredPut` - Covered stock
`VerticalCallSpread` - Vertical spread
`VerticalPutSpread` - Vertical spread
`Collar` - Collar
`Straddle` - Straddle
`Strangle` - Strangle | +| legs | object[] | YES | Legs of the combination order | +| ∟ symbol | string | YES | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | +| ∟ ratio_quantity | string | YES | Leg ratio quantity, example: `1` | +| remark | string | NO | Remark (Maximum 255 characters) | +| client_request_id | string | NO | Client request ID, used for idempotency (Maximum 64 characters) | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "order_id": 683615454870679600 + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ------------------------------------------------------------- | ------ | +| 200 | The submission was successful and the order was commissioned. | None | +| 400 | The submit was rejected with an incorrect request parameter. | None | + + diff --git a/docs/en/docs/trade/order/today_orders.md b/docs/en/docs/trade/order/today_orders.md index c4d990d43..b72f331ea 100644 --- a/docs/en/docs/trade/order/today_orders.md +++ b/docs/en/docs/trade/order/today_orders.md @@ -272,7 +272,35 @@ func main() { "trigger_price": "", "trigger_status": "NOT_USED", "updated_at": "1651644898", - "remark": "" + "remark": "", + "multi_leg": { + "strategy": 2, + "strategy_name": "Vertical spread", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 Vertical spread", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -328,3 +356,17 @@ 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 | +| ∟ multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | +| ∟∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | +| ∟∟ strategy_name | string | false | Strategy name | +| ∟∟ multileg_id | string | false | Multi-leg combination ID | +| ∟∟ code | string | false | Multi-leg combination code | +| ∟∟ legs | object[] | false | Legs of the combination order | +| ∟∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | +| ∟∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | Leg ratio quantity | +| ∟∟∟ strike_price | string | false | Strike price | +| ∟∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | +| ∟∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/overview.md b/docs/en/docs/trade/overview.md index 94543b21b..56399cd13 100644 --- a/docs/en/docs/trade/overview.md +++ b/docs/en/docs/trade/overview.md @@ -16,9 +16,12 @@ sidebar_position: 1 - Trade + Trade Submit Order + + Submit Multi-leg Order + Replace Order diff --git a/docs/zh-CN/docs/trade/order/history_orders.md b/docs/zh-CN/docs/trade/order/history_orders.md index 75dcbfd19..598a8e97c 100644 --- a/docs/zh-CN/docs/trade/order/history_orders.md +++ b/docs/zh-CN/docs/trade/order/history_orders.md @@ -282,7 +282,35 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1 + "trigger_count": 1, + "multi_leg": { + "strategy": 2, + "strategy_name": "垂直策略", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 垂直策略", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -339,3 +367,17 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟ monitor_price | string | true | 监控价格 | | ∟ trigger_count | int32 | true | 触发次数 | +| ∟ multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | +| ∟∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | +| ∟∟ strategy_name | string | false | 策略名称 | +| ∟∟ multileg_id | string | false | 多腿组合 ID | +| ∟∟ code | string | false | 多腿组合代码 | +| ∟∟ legs | object[] | false | 组合订单的各腿 | +| ∟∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | 该腿比例数量 | +| ∟∟∟ strike_price | string | false | 行权价 | +| ∟∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | +| ∟∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/order/order_detail.md b/docs/zh-CN/docs/trade/order/order_detail.md index b74edb949..a775b0d38 100644 --- a/docs/zh-CN/docs/trade/order/order_detail.md +++ b/docs/zh-CN/docs/trade/order/order_detail.md @@ -302,6 +302,34 @@ func main() { ], "total_amount": "0", "currency": "USD" + }, + "multi_leg": { + "strategy": 2, + "strategy_name": "垂直策略", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 垂直策略", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] } } } @@ -383,3 +411,17 @@ func main() { | ∟∟∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟∟∟ monitor_price | string | true | 监控价格 | | ∟∟∟ trigger_count | int32 | true | 触发次数 | +| multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | +| ∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | +| ∟ strategy_name | string | false | 策略名称 | +| ∟ multileg_id | string | false | 多腿组合 ID | +| ∟ code | string | false | 多腿组合代码 | +| ∟ legs | object[] | false | 组合订单的各腿 | +| ∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | +| ∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | +| ∟∟ ratio_quantity | string | false | 该腿比例数量 | +| ∟∟ strike_price | string | false | 行权价 | +| ∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | +| ∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | +| ∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/order/submit_multileg.md b/docs/zh-CN/docs/trade/order/submit_multileg.md new file mode 100644 index 000000000..0d0ed6a58 --- /dev/null +++ b/docs/zh-CN/docs/trade/order/submit_multileg.md @@ -0,0 +1,71 @@ +--- +slug: submit_multileg +sidebar_position: 8 +title: 多腿期权下单 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +该接口用于提交多腿期权组合订单(如垂直价差、跨式、宽跨式、领口等)。各腿作为一个策略订单一起提交。 + + + +## Request + + + + + + +
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| side | string | YES | 买卖方向

**可选值:**
`Buy`
`Sell` | +| order_type | string | YES | [订单类型](../trade-definition#ordertype) | +| submitted_price | string | NO | 下单价格,例如:`1.5`

`LO` 等限价类型订单必填 | +| submitted_quantity | string | YES | 下单数量(组合数量),例如:`1` | +| strategy | string | YES | 多腿策略

**可选值:**
`CoveredCall` - 股票担保
`CoveredPut` - 股票担保
`VerticalCallSpread` - 垂直策略
`VerticalPutSpread` - 垂直策略
`Collar` - 领式策略
`Straddle` - 跨式策略
`Strangle` - 宽跨式策略 | +| legs | object[] | YES | 组合订单的各腿 | +| ∟ symbol | string | YES | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟ ratio_quantity | string | YES | 该腿比例数量,例如:`1` | +| remark | string | NO | 备注(最多 255 字符) | +| client_request_id | string | NO | 客户端请求 ID,用于幂等(最多 64 字符) | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "order_id": 683615454870679600 + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ---------------------- | ------ | +| 200 | 提交成功,订单已委托 | None | +| 400 | 提交被拒绝,请求参数有误 | None | + + diff --git a/docs/zh-CN/docs/trade/order/today_orders.md b/docs/zh-CN/docs/trade/order/today_orders.md index 0473709b7..265123a68 100644 --- a/docs/zh-CN/docs/trade/order/today_orders.md +++ b/docs/zh-CN/docs/trade/order/today_orders.md @@ -274,7 +274,35 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1 + "trigger_count": 1, + "multi_leg": { + "strategy": 2, + "strategy_name": "垂直策略", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 垂直策略", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -330,3 +358,17 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟ trigger_count | int32 | true | 触发次数 | | ∟ monitor_price | string | true | 监控价格 | +| ∟ multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | +| ∟∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | +| ∟∟ strategy_name | string | false | 策略名称 | +| ∟∟ multileg_id | string | false | 多腿组合 ID | +| ∟∟ code | string | false | 多腿组合代码 | +| ∟∟ legs | object[] | false | 组合订单的各腿 | +| ∟∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | 该腿比例数量 | +| ∟∟∟ strike_price | string | false | 行权价 | +| ∟∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | +| ∟∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/overview.md b/docs/zh-CN/docs/trade/overview.md index ff2710671..24db5fa9e 100644 --- a/docs/zh-CN/docs/trade/overview.md +++ b/docs/zh-CN/docs/trade/overview.md @@ -17,9 +17,12 @@ sidebar_position: 1 - 交易 + 交易 委托下单 + + 多腿期权下单 + 改单 diff --git a/docs/zh-HK/docs/trade/order/history_orders.md b/docs/zh-HK/docs/trade/order/history_orders.md index 1fdfe6c48..50875b498 100644 --- a/docs/zh-HK/docs/trade/order/history_orders.md +++ b/docs/zh-HK/docs/trade/order/history_orders.md @@ -282,7 +282,35 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1 + "trigger_count": 1, + "multi_leg": { + "strategy": 2, + "strategy_name": "跨價期權", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 跨價期權", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -339,3 +367,17 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟ monitor_price | string | true | 監控價格 | | ∟ trigger_count | int32 | true | 觸發次數 | +| ∟ multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | +| ∟∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | +| ∟∟ strategy_name | string | false | 策略名稱 | +| ∟∟ multileg_id | string | false | 多腿組合 ID | +| ∟∟ code | string | false | 多腿組合代碼 | +| ∟∟ legs | object[] | false | 組合訂單的各腿 | +| ∟∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | 該腿比例數量 | +| ∟∟∟ strike_price | string | false | 行權價 | +| ∟∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | +| ∟∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/order/order_detail.md b/docs/zh-HK/docs/trade/order/order_detail.md index 32576164d..1d6b314ae 100644 --- a/docs/zh-HK/docs/trade/order/order_detail.md +++ b/docs/zh-HK/docs/trade/order/order_detail.md @@ -302,6 +302,34 @@ func main() { ], "total_amount": "0", "currency": "USD" + }, + "multi_leg": { + "strategy": 2, + "strategy_name": "跨價期權", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 跨價期權", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] } } } @@ -383,3 +411,17 @@ func main() { | ∟∟∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟∟∟ monitor_price | string | true | 監控價格 | | ∟∟∟ trigger_count | int32 | true | 觸發次數 | +| multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | +| ∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | +| ∟ strategy_name | string | false | 策略名稱 | +| ∟ multileg_id | string | false | 多腿組合 ID | +| ∟ code | string | false | 多腿組合代碼 | +| ∟ legs | object[] | false | 組合訂單的各腿 | +| ∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | +| ∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | +| ∟∟ ratio_quantity | string | false | 該腿比例數量 | +| ∟∟ strike_price | string | false | 行權價 | +| ∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | +| ∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | +| ∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/order/submit_multileg.md b/docs/zh-HK/docs/trade/order/submit_multileg.md new file mode 100644 index 000000000..b49d61d02 --- /dev/null +++ b/docs/zh-HK/docs/trade/order/submit_multileg.md @@ -0,0 +1,71 @@ +--- +slug: submit_multileg +sidebar_position: 8 +title: 多腿期權下單 +language_tabs: false +toc_footers: [] +includes: [] +search: true +highlight_theme: '' +headingLevel: 2 +--- + +該接口用於提交多腿期權組合訂單(如垂直價差、跨式、寬跨式、領口等)。各腿作為一個策略訂單一起提交。 + + + +## Request + + + + + + +
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
+ +### Parameters + +> Content-Type: application/json; charset=utf-8 + +| Name | Type | Required | Description | +| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| side | string | YES | 買賣方向

**可選值:**
`Buy`
`Sell` | +| order_type | string | YES | [訂單類型](../trade-definition#ordertype) | +| submitted_price | string | NO | 下單價格,例如:`1.5`

`LO` 等限價類型訂單必填 | +| submitted_quantity | string | YES | 下單數量(組合數量),例如:`1` | +| strategy | string | YES | 多腿策略

**可選值:**
`CoveredCall` - 股票擔保
`CoveredPut` - 股票擔保
`VerticalCallSpread` - 跨價期權
`VerticalPutSpread` - 跨價期權
`Collar` - 領式策略
`Straddle` - 馬鞍式策略
`Strangle` - 勒束式策略 | +| legs | object[] | YES | 組合訂單的各腿 | +| ∟ symbol | string | YES | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟ ratio_quantity | string | YES | 該腿比例數量,例如:`1` | +| remark | string | NO | 備註(最多 255 字符) | +| client_request_id | string | NO | 客戶端請求 ID,用於冪等(最多 64 字符) | + +### Request Example + +## Response + +### Response Headers + +- Content-Type: application/json + +### Response Example + +```json +{ + "code": 0, + "message": "success", + "data": { + "order_id": 683615454870679600 + } +} +``` + +### Response Status + +| Status | Description | Schema | +| ------ | ---------------------- | ------ | +| 200 | 提交成功,訂單已委託 | None | +| 400 | 提交被拒絕,請求參數有誤 | None | + + diff --git a/docs/zh-HK/docs/trade/order/today_orders.md b/docs/zh-HK/docs/trade/order/today_orders.md index 6f4577f6d..ca36936db 100644 --- a/docs/zh-HK/docs/trade/order/today_orders.md +++ b/docs/zh-HK/docs/trade/order/today_orders.md @@ -274,7 +274,35 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1 + "trigger_count": 1, + "multi_leg": { + "strategy": 2, + "strategy_name": "跨價期權", + "multileg_id": "Spread_QQQ20260731C764/767", + "code": "QQQ 260731 764/767 跨價期權", + "legs": [ + { + "symbol": "QQQ260731C764000.US", + "side": "Buy", + "position": "LONG", + "ratio_quantity": "1", + "strike_price": "764", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + }, + { + "symbol": "QQQ260731C767000.US", + "side": "Sell", + "position": "SHORT", + "ratio_quantity": "1", + "strike_price": "767", + "expire_date": "20260731", + "contract_direction": "C", + "contract_size": "" + } + ] + } } ] } @@ -330,3 +358,17 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟ monitor_price | string | true | 監控價格 | | ∟ trigger_count | int32 | true | 觸發次數 | +| ∟ multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | +| ∟∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | +| ∟∟ strategy_name | string | false | 策略名稱 | +| ∟∟ multileg_id | string | false | 多腿組合 ID | +| ∟∟ code | string | false | 多腿組合代碼 | +| ∟∟ legs | object[] | false | 組合訂單的各腿 | +| ∟∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | +| ∟∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | +| ∟∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | +| ∟∟∟ ratio_quantity | string | false | 該腿比例數量 | +| ∟∟∟ strike_price | string | false | 行權價 | +| ∟∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | +| ∟∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | +| ∟∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/overview.md b/docs/zh-HK/docs/trade/overview.md index 3b2d12ee2..e9c18b077 100644 --- a/docs/zh-HK/docs/trade/overview.md +++ b/docs/zh-HK/docs/trade/overview.md @@ -17,9 +17,12 @@ sidebar_position: 1 - 交易 + 交易 委托下單 + + 多腿期權下單 + 改單 From cb41602712e5f5ef0aeb1a67033872078f88b2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=9F=B3=E7=85=9C?= Date: Mon, 6 Jul 2026 10:36:09 +0800 Subject: [PATCH 4/7] Revert "docs(trade): add multi-leg option order docs" --- docs/en/docs/trade/order/history_orders.md | 44 +----------- docs/en/docs/trade/order/order_detail.md | 42 ----------- docs/en/docs/trade/order/submit_multileg.md | 71 ------------------- docs/en/docs/trade/order/today_orders.md | 44 +----------- docs/en/docs/trade/overview.md | 5 +- docs/zh-CN/docs/trade/order/history_orders.md | 44 +----------- docs/zh-CN/docs/trade/order/order_detail.md | 42 ----------- .../zh-CN/docs/trade/order/submit_multileg.md | 71 ------------------- docs/zh-CN/docs/trade/order/today_orders.md | 44 +----------- docs/zh-CN/docs/trade/overview.md | 5 +- docs/zh-HK/docs/trade/order/history_orders.md | 44 +----------- docs/zh-HK/docs/trade/order/order_detail.md | 42 ----------- .../zh-HK/docs/trade/order/submit_multileg.md | 71 ------------------- docs/zh-HK/docs/trade/order/today_orders.md | 44 +----------- docs/zh-HK/docs/trade/overview.md | 5 +- 15 files changed, 9 insertions(+), 609 deletions(-) delete mode 100644 docs/en/docs/trade/order/submit_multileg.md delete mode 100644 docs/zh-CN/docs/trade/order/submit_multileg.md delete mode 100644 docs/zh-HK/docs/trade/order/submit_multileg.md diff --git a/docs/en/docs/trade/order/history_orders.md b/docs/en/docs/trade/order/history_orders.md index c54e1b392..77f8ccdba 100644 --- a/docs/en/docs/trade/order/history_orders.md +++ b/docs/en/docs/trade/order/history_orders.md @@ -283,35 +283,7 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1, - "multi_leg": { - "strategy": 2, - "strategy_name": "Vertical spread", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 Vertical spread", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "trigger_count": 1 } ] } @@ -368,17 +340,3 @@ 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 | -| ∟ multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | -| ∟∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | -| ∟∟ strategy_name | string | false | Strategy name | -| ∟∟ multileg_id | string | false | Multi-leg combination ID | -| ∟∟ code | string | false | Multi-leg combination code | -| ∟∟ legs | object[] | false | Legs of the combination order | -| ∟∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | -| ∟∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | Leg ratio quantity | -| ∟∟∟ strike_price | string | false | Strike price | -| ∟∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | -| ∟∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/order/order_detail.md b/docs/en/docs/trade/order/order_detail.md index 9177a003e..31eda2c5a 100644 --- a/docs/en/docs/trade/order/order_detail.md +++ b/docs/en/docs/trade/order/order_detail.md @@ -303,34 +303,6 @@ func main() { ], "total_amount": "0", "currency": "USD" - }, - "multi_leg": { - "strategy": 2, - "strategy_name": "Vertical spread", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 Vertical spread", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] } } } @@ -412,17 +384,3 @@ Order Information | ∟∟∟ limit_depth_level | int32 | true | Specifies the bid/ask depth level | | ∟∟∟ monitor_price | string | true | Monitoring price | | ∟∟∟ trigger_count | int32 | true | Number of triggers | -| multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | -| ∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | -| ∟ strategy_name | string | false | Strategy name | -| ∟ multileg_id | string | false | Multi-leg combination ID | -| ∟ code | string | false | Multi-leg combination code | -| ∟ legs | object[] | false | Legs of the combination order | -| ∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | -| ∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | -| ∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | -| ∟∟ ratio_quantity | string | false | Leg ratio quantity | -| ∟∟ strike_price | string | false | Strike price | -| ∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | -| ∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | -| ∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/order/submit_multileg.md b/docs/en/docs/trade/order/submit_multileg.md deleted file mode 100644 index 26b82a38c..000000000 --- a/docs/en/docs/trade/order/submit_multileg.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -slug: submit_multileg -sidebar_position: 8 -title: Submit Multi-leg Order -language_tabs: false -toc_footers: [] -includes: [] -search: true -highlight_theme: '' -headingLevel: 2 ---- - -This API is used to submit a multi-leg option combination order (such as vertical spreads, straddles, strangles, collars, etc.). All legs are submitted together as a single strategy order. - - - -## Request - - - - - - -
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
- -### Parameters - -> Content-Type: application/json; charset=utf-8 - -| Name | Type | Required | Description | -| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| side | string | YES | Order Side

**Enum Value:**
`Buy`
`Sell` | -| order_type | string | YES | [Order Type](../trade-definition#ordertype) | -| submitted_price | string | NO | Submitted price, example: `1.5`

Required for limit order types such as `LO` | -| submitted_quantity | string | YES | Submitted quantity (number of combinations), example: `1` | -| strategy | string | YES | Multi-leg strategy

**Enum Value:**
`CoveredCall` - Covered stock
`CoveredPut` - Covered stock
`VerticalCallSpread` - Vertical spread
`VerticalPutSpread` - Vertical spread
`Collar` - Collar
`Straddle` - Straddle
`Strangle` - Strangle | -| legs | object[] | YES | Legs of the combination order | -| ∟ symbol | string | YES | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | -| ∟ ratio_quantity | string | YES | Leg ratio quantity, example: `1` | -| remark | string | NO | Remark (Maximum 255 characters) | -| client_request_id | string | NO | Client request ID, used for idempotency (Maximum 64 characters) | - -### Request Example - -## Response - -### Response Headers - -- Content-Type: application/json - -### Response Example - -```json -{ - "code": 0, - "message": "success", - "data": { - "order_id": 683615454870679600 - } -} -``` - -### Response Status - -| Status | Description | Schema | -| ------ | ------------------------------------------------------------- | ------ | -| 200 | The submission was successful and the order was commissioned. | None | -| 400 | The submit was rejected with an incorrect request parameter. | None | - - diff --git a/docs/en/docs/trade/order/today_orders.md b/docs/en/docs/trade/order/today_orders.md index b72f331ea..c4d990d43 100644 --- a/docs/en/docs/trade/order/today_orders.md +++ b/docs/en/docs/trade/order/today_orders.md @@ -272,35 +272,7 @@ func main() { "trigger_price": "", "trigger_status": "NOT_USED", "updated_at": "1651644898", - "remark": "", - "multi_leg": { - "strategy": 2, - "strategy_name": "Vertical spread", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 Vertical spread", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "remark": "" } ] } @@ -356,17 +328,3 @@ 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 | -| ∟ multi_leg | object | false | Multi-leg strategy information. Only returned for multi-leg option combination orders; otherwise not returned. | -| ∟∟ strategy | int32 | false | Multi-leg strategy

**Enum Value:**
`0` - CoveredCall (Covered stock)
`1` - CoveredPut (Covered stock)
`2` - VerticalCallSpread (Vertical spread)
`3` - VerticalPutSpread (Vertical spread)
`4` - Collar
`5` - Straddle
`6` - Strangle | -| ∟∟ strategy_name | string | false | Strategy name | -| ∟∟ multileg_id | string | false | Multi-leg combination ID | -| ∟∟ code | string | false | Multi-leg combination code | -| ∟∟ legs | object[] | false | Legs of the combination order | -| ∟∟∟ symbol | string | false | Option symbol, use `ticker.region` format, example: `QQQ260731C764000.US` | -| ∟∟∟ side | string | false | Order Side

**Enum Value:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | Position direction

**Enum Value:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | Leg ratio quantity | -| ∟∟∟ strike_price | string | false | Strike price | -| ∟∟∟ expire_date | string | false | Option expiry date, format: `YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | Contract type

**Enum Value:**
`C` - Call
`P` - Put | -| ∟∟∟ contract_size | string | false | Contract size | diff --git a/docs/en/docs/trade/overview.md b/docs/en/docs/trade/overview.md index 56399cd13..94543b21b 100644 --- a/docs/en/docs/trade/overview.md +++ b/docs/en/docs/trade/overview.md @@ -16,12 +16,9 @@ sidebar_position: 1 - Trade + Trade Submit Order - - Submit Multi-leg Order - Replace Order diff --git a/docs/zh-CN/docs/trade/order/history_orders.md b/docs/zh-CN/docs/trade/order/history_orders.md index 598a8e97c..75dcbfd19 100644 --- a/docs/zh-CN/docs/trade/order/history_orders.md +++ b/docs/zh-CN/docs/trade/order/history_orders.md @@ -282,35 +282,7 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1, - "multi_leg": { - "strategy": 2, - "strategy_name": "垂直策略", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 垂直策略", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "trigger_count": 1 } ] } @@ -367,17 +339,3 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟ monitor_price | string | true | 监控价格 | | ∟ trigger_count | int32 | true | 触发次数 | -| ∟ multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | -| ∟∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | -| ∟∟ strategy_name | string | false | 策略名称 | -| ∟∟ multileg_id | string | false | 多腿组合 ID | -| ∟∟ code | string | false | 多腿组合代码 | -| ∟∟ legs | object[] | false | 组合订单的各腿 | -| ∟∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | 该腿比例数量 | -| ∟∟∟ strike_price | string | false | 行权价 | -| ∟∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | -| ∟∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/order/order_detail.md b/docs/zh-CN/docs/trade/order/order_detail.md index a775b0d38..b74edb949 100644 --- a/docs/zh-CN/docs/trade/order/order_detail.md +++ b/docs/zh-CN/docs/trade/order/order_detail.md @@ -302,34 +302,6 @@ func main() { ], "total_amount": "0", "currency": "USD" - }, - "multi_leg": { - "strategy": 2, - "strategy_name": "垂直策略", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 垂直策略", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] } } } @@ -411,17 +383,3 @@ func main() { | ∟∟∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟∟∟ monitor_price | string | true | 监控价格 | | ∟∟∟ trigger_count | int32 | true | 触发次数 | -| multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | -| ∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | -| ∟ strategy_name | string | false | 策略名称 | -| ∟ multileg_id | string | false | 多腿组合 ID | -| ∟ code | string | false | 多腿组合代码 | -| ∟ legs | object[] | false | 组合订单的各腿 | -| ∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | -| ∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | -| ∟∟ ratio_quantity | string | false | 该腿比例数量 | -| ∟∟ strike_price | string | false | 行权价 | -| ∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | -| ∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | -| ∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/order/submit_multileg.md b/docs/zh-CN/docs/trade/order/submit_multileg.md deleted file mode 100644 index 0d0ed6a58..000000000 --- a/docs/zh-CN/docs/trade/order/submit_multileg.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -slug: submit_multileg -sidebar_position: 8 -title: 多腿期权下单 -language_tabs: false -toc_footers: [] -includes: [] -search: true -highlight_theme: '' -headingLevel: 2 ---- - -该接口用于提交多腿期权组合订单(如垂直价差、跨式、宽跨式、领口等)。各腿作为一个策略订单一起提交。 - - - -## Request - - - - - - -
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
- -### Parameters - -> Content-Type: application/json; charset=utf-8 - -| Name | Type | Required | Description | -| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| side | string | YES | 买卖方向

**可选值:**
`Buy`
`Sell` | -| order_type | string | YES | [订单类型](../trade-definition#ordertype) | -| submitted_price | string | NO | 下单价格,例如:`1.5`

`LO` 等限价类型订单必填 | -| submitted_quantity | string | YES | 下单数量(组合数量),例如:`1` | -| strategy | string | YES | 多腿策略

**可选值:**
`CoveredCall` - 股票担保
`CoveredPut` - 股票担保
`VerticalCallSpread` - 垂直策略
`VerticalPutSpread` - 垂直策略
`Collar` - 领式策略
`Straddle` - 跨式策略
`Strangle` - 宽跨式策略 | -| legs | object[] | YES | 组合订单的各腿 | -| ∟ symbol | string | YES | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟ ratio_quantity | string | YES | 该腿比例数量,例如:`1` | -| remark | string | NO | 备注(最多 255 字符) | -| client_request_id | string | NO | 客户端请求 ID,用于幂等(最多 64 字符) | - -### Request Example - -## Response - -### Response Headers - -- Content-Type: application/json - -### Response Example - -```json -{ - "code": 0, - "message": "success", - "data": { - "order_id": 683615454870679600 - } -} -``` - -### Response Status - -| Status | Description | Schema | -| ------ | ---------------------- | ------ | -| 200 | 提交成功,订单已委托 | None | -| 400 | 提交被拒绝,请求参数有误 | None | - - diff --git a/docs/zh-CN/docs/trade/order/today_orders.md b/docs/zh-CN/docs/trade/order/today_orders.md index 265123a68..0473709b7 100644 --- a/docs/zh-CN/docs/trade/order/today_orders.md +++ b/docs/zh-CN/docs/trade/order/today_orders.md @@ -274,35 +274,7 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1, - "multi_leg": { - "strategy": 2, - "strategy_name": "垂直策略", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 垂直策略", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "trigger_count": 1 } ] } @@ -358,17 +330,3 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定买卖档位 | | ∟ trigger_count | int32 | true | 触发次数 | | ∟ monitor_price | string | true | 监控价格 | -| ∟ multi_leg | object | false | 多腿策略信息,仅多腿期权组合订单返回,非组合订单不返回。 | -| ∟∟ strategy | int32 | false | 多腿策略

**可选值:**
`0` - CoveredCall(股票担保)
`1` - CoveredPut(股票担保)
`2` - VerticalCallSpread(垂直策略)
`3` - VerticalPutSpread(垂直策略)
`4` - Collar(领式策略)
`5` - Straddle(跨式策略)
`6` - Strangle(宽跨式策略) | -| ∟∟ strategy_name | string | false | 策略名称 | -| ∟∟ multileg_id | string | false | 多腿组合 ID | -| ∟∟ code | string | false | 多腿组合代码 | -| ∟∟ legs | object[] | false | 组合订单的各腿 | -| ∟∟∟ symbol | string | false | 期权 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟∟ side | string | false | 买卖方向

**可选值:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | 持仓方向

**可选值:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | 该腿比例数量 | -| ∟∟∟ strike_price | string | false | 行权价 | -| ∟∟∟ expire_date | string | false | 期权到期日,格式:`YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | 合约类型

**可选值:**
`C` - 看涨(Call)
`P` - 看跌(Put) | -| ∟∟∟ contract_size | string | false | 合约乘数 | diff --git a/docs/zh-CN/docs/trade/overview.md b/docs/zh-CN/docs/trade/overview.md index 24db5fa9e..ff2710671 100644 --- a/docs/zh-CN/docs/trade/overview.md +++ b/docs/zh-CN/docs/trade/overview.md @@ -17,12 +17,9 @@ sidebar_position: 1 - 交易 + 交易 委托下单 - - 多腿期权下单 - 改单 diff --git a/docs/zh-HK/docs/trade/order/history_orders.md b/docs/zh-HK/docs/trade/order/history_orders.md index 50875b498..1fdfe6c48 100644 --- a/docs/zh-HK/docs/trade/order/history_orders.md +++ b/docs/zh-HK/docs/trade/order/history_orders.md @@ -282,35 +282,7 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1, - "multi_leg": { - "strategy": 2, - "strategy_name": "跨價期權", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 跨價期權", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "trigger_count": 1 } ] } @@ -367,17 +339,3 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟ monitor_price | string | true | 監控價格 | | ∟ trigger_count | int32 | true | 觸發次數 | -| ∟ multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | -| ∟∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | -| ∟∟ strategy_name | string | false | 策略名稱 | -| ∟∟ multileg_id | string | false | 多腿組合 ID | -| ∟∟ code | string | false | 多腿組合代碼 | -| ∟∟ legs | object[] | false | 組合訂單的各腿 | -| ∟∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | 該腿比例數量 | -| ∟∟∟ strike_price | string | false | 行權價 | -| ∟∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | -| ∟∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/order/order_detail.md b/docs/zh-HK/docs/trade/order/order_detail.md index 1d6b314ae..32576164d 100644 --- a/docs/zh-HK/docs/trade/order/order_detail.md +++ b/docs/zh-HK/docs/trade/order/order_detail.md @@ -302,34 +302,6 @@ func main() { ], "total_amount": "0", "currency": "USD" - }, - "multi_leg": { - "strategy": 2, - "strategy_name": "跨價期權", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 跨價期權", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] } } } @@ -411,17 +383,3 @@ func main() { | ∟∟∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟∟∟ monitor_price | string | true | 監控價格 | | ∟∟∟ trigger_count | int32 | true | 觸發次數 | -| multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | -| ∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | -| ∟ strategy_name | string | false | 策略名稱 | -| ∟ multileg_id | string | false | 多腿組合 ID | -| ∟ code | string | false | 多腿組合代碼 | -| ∟ legs | object[] | false | 組合訂單的各腿 | -| ∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | -| ∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | -| ∟∟ ratio_quantity | string | false | 該腿比例數量 | -| ∟∟ strike_price | string | false | 行權價 | -| ∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | -| ∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | -| ∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/order/submit_multileg.md b/docs/zh-HK/docs/trade/order/submit_multileg.md deleted file mode 100644 index b49d61d02..000000000 --- a/docs/zh-HK/docs/trade/order/submit_multileg.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -slug: submit_multileg -sidebar_position: 8 -title: 多腿期權下單 -language_tabs: false -toc_footers: [] -includes: [] -search: true -highlight_theme: '' -headingLevel: 2 ---- - -該接口用於提交多腿期權組合訂單(如垂直價差、跨式、寬跨式、領口等)。各腿作為一個策略訂單一起提交。 - - - -## Request - - - - - - -
HTTP MethodPOST
HTTP URL/v1/trade/order/multileg
- -### Parameters - -> Content-Type: application/json; charset=utf-8 - -| Name | Type | Required | Description | -| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| side | string | YES | 買賣方向

**可選值:**
`Buy`
`Sell` | -| order_type | string | YES | [訂單類型](../trade-definition#ordertype) | -| submitted_price | string | NO | 下單價格,例如:`1.5`

`LO` 等限價類型訂單必填 | -| submitted_quantity | string | YES | 下單數量(組合數量),例如:`1` | -| strategy | string | YES | 多腿策略

**可選值:**
`CoveredCall` - 股票擔保
`CoveredPut` - 股票擔保
`VerticalCallSpread` - 跨價期權
`VerticalPutSpread` - 跨價期權
`Collar` - 領式策略
`Straddle` - 馬鞍式策略
`Strangle` - 勒束式策略 | -| legs | object[] | YES | 組合訂單的各腿 | -| ∟ symbol | string | YES | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟ ratio_quantity | string | YES | 該腿比例數量,例如:`1` | -| remark | string | NO | 備註(最多 255 字符) | -| client_request_id | string | NO | 客戶端請求 ID,用於冪等(最多 64 字符) | - -### Request Example - -## Response - -### Response Headers - -- Content-Type: application/json - -### Response Example - -```json -{ - "code": 0, - "message": "success", - "data": { - "order_id": 683615454870679600 - } -} -``` - -### Response Status - -| Status | Description | Schema | -| ------ | ---------------------- | ------ | -| 200 | 提交成功,訂單已委託 | None | -| 400 | 提交被拒絕,請求參數有誤 | None | - - diff --git a/docs/zh-HK/docs/trade/order/today_orders.md b/docs/zh-HK/docs/trade/order/today_orders.md index ca36936db..6f4577f6d 100644 --- a/docs/zh-HK/docs/trade/order/today_orders.md +++ b/docs/zh-HK/docs/trade/order/today_orders.md @@ -274,35 +274,7 @@ func main() { "remark": "", "limit_depth_level": 0, "monitor_price": "", - "trigger_count": 1, - "multi_leg": { - "strategy": 2, - "strategy_name": "跨價期權", - "multileg_id": "Spread_QQQ20260731C764/767", - "code": "QQQ 260731 764/767 跨價期權", - "legs": [ - { - "symbol": "QQQ260731C764000.US", - "side": "Buy", - "position": "LONG", - "ratio_quantity": "1", - "strike_price": "764", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - }, - { - "symbol": "QQQ260731C767000.US", - "side": "Sell", - "position": "SHORT", - "ratio_quantity": "1", - "strike_price": "767", - "expire_date": "20260731", - "contract_direction": "C", - "contract_size": "" - } - ] - } + "trigger_count": 1 } ] } @@ -358,17 +330,3 @@ func main() { | ∟ limit_depth_level | int32 | true | 指定買賣檔位 | | ∟ monitor_price | string | true | 監控價格 | | ∟ trigger_count | int32 | true | 觸發次數 | -| ∟ multi_leg | object | false | 多腿策略信息,僅多腿期權組合訂單返回,非組合訂單不返回。 | -| ∟∟ strategy | int32 | false | 多腿策略

**可選值:**
`0` - CoveredCall(股票擔保)
`1` - CoveredPut(股票擔保)
`2` - VerticalCallSpread(跨價期權)
`3` - VerticalPutSpread(跨價期權)
`4` - Collar(領式策略)
`5` - Straddle(馬鞍式策略)
`6` - Strangle(勒束式策略) | -| ∟∟ strategy_name | string | false | 策略名稱 | -| ∟∟ multileg_id | string | false | 多腿組合 ID | -| ∟∟ code | string | false | 多腿組合代碼 | -| ∟∟ legs | object[] | false | 組合訂單的各腿 | -| ∟∟∟ symbol | string | false | 期權 symbol,使用 `ticker.region` 格式,例如:`QQQ260731C764000.US` | -| ∟∟∟ side | string | false | 買賣方向

**可選值:**
`Buy`
`Sell` | -| ∟∟∟ position | string | false | 持倉方向

**可選值:**
`LONG`
`SHORT` | -| ∟∟∟ ratio_quantity | string | false | 該腿比例數量 | -| ∟∟∟ strike_price | string | false | 行權價 | -| ∟∟∟ expire_date | string | false | 期權到期日,格式:`YYYYMMDD` | -| ∟∟∟ contract_direction | string | false | 合約類型

**可選值:**
`C` - 看漲(Call)
`P` - 看跌(Put) | -| ∟∟∟ contract_size | string | false | 合約乘數 | diff --git a/docs/zh-HK/docs/trade/overview.md b/docs/zh-HK/docs/trade/overview.md index e9c18b077..3b2d12ee2 100644 --- a/docs/zh-HK/docs/trade/overview.md +++ b/docs/zh-HK/docs/trade/overview.md @@ -17,12 +17,9 @@ sidebar_position: 1 - 交易 + 交易 委托下單 - - 多腿期權下單 - 改單 From 0e28d5ae300b09b4d4616c1ac2dad03b30404870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=9F=B3=E7=85=9C?= Date: Wed, 8 Jul 2026 09:46:21 +0800 Subject: [PATCH 5/7] alter page type in AllDeals request --- docs/en/docs/trade/execution/all_executions.md | 2 +- docs/zh-CN/docs/trade/execution/all_executions.md | 2 +- docs/zh-HK/docs/trade/execution/all_executions.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/docs/trade/execution/all_executions.md b/docs/en/docs/trade/execution/all_executions.md index cb5e38e91..a50d3f878 100644 --- a/docs/en/docs/trade/execution/all_executions.md +++ b/docs/en/docs/trade/execution/all_executions.md @@ -33,7 +33,7 @@ This API is used to query execution (fill) records, including both buy and sell | order_id | string | NO | Order ID, example: `701276261045858304` | | start_at | string | NO | Start time, formatted as a timestamp (second), example: `1650410999`.

If the start time is null, the default is the 90 days before of the end time or 90 days before of the current time. | | end_at | string | NO | End time, formatted as a timestamp (second), example: `1650410999`.

If the end time is null, the default is the current time or 90 days after of the start time. | -| page | string | NO | Page number, starting from `1`. The maximum number of records per query is 1000. If the number of results exceeds 1000, `has_more` will be `true`, use `page` together with `has_more` to paginate. | +| page | int32 | NO | Page number, starting from `1`. The maximum number of records per query is 1000. If the number of results exceeds 1000, `has_more` will be `true`, use `page` together with `has_more` to paginate. | ### Request Example diff --git a/docs/zh-CN/docs/trade/execution/all_executions.md b/docs/zh-CN/docs/trade/execution/all_executions.md index 23c248df6..107ccda38 100644 --- a/docs/zh-CN/docs/trade/execution/all_executions.md +++ b/docs/zh-CN/docs/trade/execution/all_executions.md @@ -33,7 +33,7 @@ headingLevel: 2 | order_id | string | NO | 订单 ID,例如:`701276261045858304` | | start_at | string | NO | 开始时间,格式为时间戳 (秒),例如:`1650410999`。

开始时间为空时,默认为结束时间或当前时间前九十天。 | | end_at | string | NO | 结束时间,格式为时间戳 (秒),例如:`1650410999`。

结束时间为空时,默认为开始时间后九十天或当前时间。 | -| page | string | NO | 页码,从 `1` 开始。单次查询最多返回 1000 条记录,若结果超过 1000 条,`has_more` 为 `true`,可结合 `has_more` 翻页。 | +| page | int32 | NO | 页码,从 `1` 开始。单次查询最多返回 1000 条记录,若结果超过 1000 条,`has_more` 为 `true`,可结合 `has_more` 翻页。 | ### Request Example diff --git a/docs/zh-HK/docs/trade/execution/all_executions.md b/docs/zh-HK/docs/trade/execution/all_executions.md index d5ed53b48..bbcf3ffa1 100644 --- a/docs/zh-HK/docs/trade/execution/all_executions.md +++ b/docs/zh-HK/docs/trade/execution/all_executions.md @@ -33,7 +33,7 @@ headingLevel: 2 | order_id | string | NO | 訂單 ID,例如:`701276261045858304` | | start_at | string | NO | 開始時間,格式為時間戳 (秒),例如:`1650410999`。

開始時間為空時,默認為結束時間或當前時間前九十天。 | | end_at | string | NO | 結束時間,格式為時間戳 (秒),例如:`1650410999`。

結束時間為空時,默認為開始時間後九十天或當前時間。 | -| page | string | NO | 頁碼,從 `1` 開始。單次查詢最多返回 1000 條記錄,若結果超過 1000 條,`has_more` 為 `true`,可結合 `has_more` 翻頁。 | +| page | int32 | NO | 頁碼,從 `1` 開始。單次查詢最多返回 1000 條記錄,若結果超過 1000 條,`has_more` 為 `true`,可結合 `has_more` 翻頁。 | ### Request Example From 293030b23dbc90cede0cc623db63cf83bf6c5e14 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 8 Jul 2026 11:31:01 +0800 Subject: [PATCH 6/7] fix(SDKLinks): add Java anchor for getAllExecutions --- docs/.vitepress/theme/components/SDKLinks.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/.vitepress/theme/components/SDKLinks.vue b/docs/.vitepress/theme/components/SDKLinks.vue index 583a4322e..fae6bae10 100644 --- a/docs/.vitepress/theme/components/SDKLinks.vue +++ b/docs/.vitepress/theme/components/SDKLinks.vue @@ -180,6 +180,7 @@ const JAVA_ANCHOR_MAP: Record = { setOnTrades: 'setOnTrades(com.longbridge.quote.TradesHandler)', getHistoryExecutions: 'getHistoryExecutions(com.longbridge.trade.GetHistoryExecutionsOptions)', getTodayExecutions: 'getTodayExecutions(com.longbridge.trade.GetTodayExecutionsOptions)', + getAllExecutions: 'getAllExecutions(com.longbridge.trade.GetAllExecutionsOptions)', getHistoryOrders: 'getHistoryOrders(com.longbridge.trade.GetHistoryOrdersOptions)', getTodayOrders: 'getTodayOrders(com.longbridge.trade.GetTodayOrdersOptions)', replaceOrder: 'replaceOrder(com.longbridge.trade.ReplaceOrderOptions)', From a17f0920870050d9445ef373f0e6f8ea750c5572 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 8 Jul 2026 11:36:42 +0800 Subject: [PATCH 7/7] docs(trade): add request examples for all_executions API --- .../en/docs/trade/execution/all_executions.md | 198 ++++++++++++++++++ .../docs/trade/execution/all_executions.md | 198 ++++++++++++++++++ .../docs/trade/execution/all_executions.md | 198 ++++++++++++++++++ 3 files changed, 594 insertions(+) diff --git a/docs/en/docs/trade/execution/all_executions.md b/docs/en/docs/trade/execution/all_executions.md index a50d3f878..c637134fc 100644 --- a/docs/en/docs/trade/execution/all_executions.md +++ b/docs/en/docs/trade/execution/all_executions.md @@ -37,6 +37,204 @@ This API is used to query execution (fill) records, including both buy and sell ### Request Example + + + +```python +from datetime import datetime +from longbridge.openapi import TradeContext, Config, OAuthBuilder + +oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url)) +config = Config.from_oauth(oauth) +ctx = TradeContext(config) + +resp = ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), +) +print(resp) +``` + + + + +```python +import asyncio +from datetime import datetime +from longbridge.openapi import AsyncTradeContext, Config, OAuthBuilder + +async def main() -> None: + oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url)) + config = Config.from_oauth(oauth) + ctx = AsyncTradeContext.create(config) + + resp = await ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), + ) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```javascript +const { Config, TradeContext, OAuth } = require('longbridge') + +async function main() { + const oauth = await OAuth.build('your-client-id', (_, url) => { + console.log('Open this URL to authorize: ' + url) + }) + const config = Config.fromOAuth(oauth) + const ctx = TradeContext.new(config) + const resp = await ctx.allExecutions({ symbol: '700.HK' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```java +import com.longbridge.*; +import com.longbridge.trade.*; + +class Main { + public static void main(String[] args) throws Exception { + try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get(); + Config config = Config.fromOAuth(oauth); + TradeContext ctx = TradeContext.create(config)) { + AllExecutionsResponse resp = ctx.getAllExecutions(null).get(); + for (Execution e : resp.getTrades()) System.out.println(e); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, trade::TradeContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open this URL to authorize: {url}")).await?; + let config = Arc::new(Config::from_oauth(oauth)); + let (ctx, _) = TradeContext::new(config); + let resp = ctx.all_executions(None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace longbridge; +using namespace longbridge::trade; + +static void +run(const OAuth& oauth) +{ + Config config = Config::from_oauth(oauth); + TradeContext ctx = TradeContext::create(config); + + ctx.all_executions(std::nullopt, [](auto res) { + if (!res) { std::cout << "failed" << std::endl; return; } + for (const auto& e : res->trades) std::cout << e.order_id << std::endl; + }); +} + +int main(int argc, char const* argv[]) { +#ifdef WIN32 + SetConsoleOutputCP(CP_UTF8); +#endif + + const std::string client_id = "your-client-id"; + OAuthBuilder(client_id).build( + [](const std::string& url) { + std::cout << "Open this URL to authorize: " << url << std::endl; + }, + [](auto res) { + if (!res) { + std::cout << "authorization failed: " << *res.status().message() << std::endl; + return; + } + run(*res); + }); + + std::cin.get(); + return 0; +} +``` + + + + +```go +package main + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/longbridge/openapi-go/config" + "github.com/longbridge/openapi-go/oauth" + "github.com/longbridge/openapi-go/trade" +) + +func main() { + o := oauth.New("your-client-id"). + OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) }) + if err := o.Build(context.Background()); err != nil { + log.Fatal(err) + } + conf, err := config.New(config.WithOAuthClient(o)) + if err != nil { + log.Fatal(err) + } + tctx, err := trade.NewFromCfg(conf) + if err != nil { + log.Fatal(err) + } + defer tctx.Close() + start := time.Date(2022, 5, 9, 0, 0, 0, 0, time.UTC) + end := time.Date(2022, 5, 12, 0, 0, 0, 0, time.UTC) + resp, err := tctx.AllExecutions(context.Background(), &trade.GetAllExecutions{ + Symbol: "700.HK", + StartAt: start, + EndAt: end, + }) + if err != nil { + log.Fatal(err) + } + for _, e := range resp.Trades { + fmt.Println(e.OrderId) + } +} +``` + + + + ## Response ### Response Headers diff --git a/docs/zh-CN/docs/trade/execution/all_executions.md b/docs/zh-CN/docs/trade/execution/all_executions.md index 107ccda38..3b76ad9e1 100644 --- a/docs/zh-CN/docs/trade/execution/all_executions.md +++ b/docs/zh-CN/docs/trade/execution/all_executions.md @@ -37,6 +37,204 @@ headingLevel: 2 ### Request Example + + + +```python +from datetime import datetime +from longbridge.openapi import TradeContext, Config, OAuthBuilder + +oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url)) +config = Config.from_oauth(oauth) +ctx = TradeContext(config) + +resp = ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), +) +print(resp) +``` + + + + +```python +import asyncio +from datetime import datetime +from longbridge.openapi import AsyncTradeContext, Config, OAuthBuilder + +async def main() -> None: + oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url)) + config = Config.from_oauth(oauth) + ctx = AsyncTradeContext.create(config) + + resp = await ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), + ) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```javascript +const { Config, TradeContext, OAuth } = require('longbridge') + +async function main() { + const oauth = await OAuth.build('your-client-id', (_, url) => { + console.log('Open this URL to authorize: ' + url) + }) + const config = Config.fromOAuth(oauth) + const ctx = TradeContext.new(config) + const resp = await ctx.allExecutions({ symbol: '700.HK' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```java +import com.longbridge.*; +import com.longbridge.trade.*; + +class Main { + public static void main(String[] args) throws Exception { + try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get(); + Config config = Config.fromOAuth(oauth); + TradeContext ctx = TradeContext.create(config)) { + AllExecutionsResponse resp = ctx.getAllExecutions(null).get(); + for (Execution e : resp.getTrades()) System.out.println(e); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, trade::TradeContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open this URL to authorize: {url}")).await?; + let config = Arc::new(Config::from_oauth(oauth)); + let (ctx, _) = TradeContext::new(config); + let resp = ctx.all_executions(None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace longbridge; +using namespace longbridge::trade; + +static void +run(const OAuth& oauth) +{ + Config config = Config::from_oauth(oauth); + TradeContext ctx = TradeContext::create(config); + + ctx.all_executions(std::nullopt, [](auto res) { + if (!res) { std::cout << "failed" << std::endl; return; } + for (const auto& e : res->trades) std::cout << e.order_id << std::endl; + }); +} + +int main(int argc, char const* argv[]) { +#ifdef WIN32 + SetConsoleOutputCP(CP_UTF8); +#endif + + const std::string client_id = "your-client-id"; + OAuthBuilder(client_id).build( + [](const std::string& url) { + std::cout << "Open this URL to authorize: " << url << std::endl; + }, + [](auto res) { + if (!res) { + std::cout << "authorization failed: " << *res.status().message() << std::endl; + return; + } + run(*res); + }); + + std::cin.get(); + return 0; +} +``` + + + + +```go +package main + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/longbridge/openapi-go/config" + "github.com/longbridge/openapi-go/oauth" + "github.com/longbridge/openapi-go/trade" +) + +func main() { + o := oauth.New("your-client-id"). + OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) }) + if err := o.Build(context.Background()); err != nil { + log.Fatal(err) + } + conf, err := config.New(config.WithOAuthClient(o)) + if err != nil { + log.Fatal(err) + } + tctx, err := trade.NewFromCfg(conf) + if err != nil { + log.Fatal(err) + } + defer tctx.Close() + start := time.Date(2022, 5, 9, 0, 0, 0, 0, time.UTC) + end := time.Date(2022, 5, 12, 0, 0, 0, 0, time.UTC) + resp, err := tctx.AllExecutions(context.Background(), &trade.GetAllExecutions{ + Symbol: "700.HK", + StartAt: start, + EndAt: end, + }) + if err != nil { + log.Fatal(err) + } + for _, e := range resp.Trades { + fmt.Println(e.OrderId) + } +} +``` + + + + ## Response ### Response Headers diff --git a/docs/zh-HK/docs/trade/execution/all_executions.md b/docs/zh-HK/docs/trade/execution/all_executions.md index bbcf3ffa1..39dce7b56 100644 --- a/docs/zh-HK/docs/trade/execution/all_executions.md +++ b/docs/zh-HK/docs/trade/execution/all_executions.md @@ -37,6 +37,204 @@ headingLevel: 2 ### Request Example + + + +```python +from datetime import datetime +from longbridge.openapi import TradeContext, Config, OAuthBuilder + +oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url)) +config = Config.from_oauth(oauth) +ctx = TradeContext(config) + +resp = ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), +) +print(resp) +``` + + + + +```python +import asyncio +from datetime import datetime +from longbridge.openapi import AsyncTradeContext, Config, OAuthBuilder + +async def main() -> None: + oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url)) + config = Config.from_oauth(oauth) + ctx = AsyncTradeContext.create(config) + + resp = await ctx.all_executions( + symbol = "700.HK", + start_at = datetime(2022, 5, 9), + end_at = datetime(2022, 5, 12), + ) + print(resp) + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + +```javascript +const { Config, TradeContext, OAuth } = require('longbridge') + +async function main() { + const oauth = await OAuth.build('your-client-id', (_, url) => { + console.log('Open this URL to authorize: ' + url) + }) + const config = Config.fromOAuth(oauth) + const ctx = TradeContext.new(config) + const resp = await ctx.allExecutions({ symbol: '700.HK' }) + console.log(resp) +} +main().catch(console.error) +``` + + + + +```java +import com.longbridge.*; +import com.longbridge.trade.*; + +class Main { + public static void main(String[] args) throws Exception { + try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get(); + Config config = Config.fromOAuth(oauth); + TradeContext ctx = TradeContext.create(config)) { + AllExecutionsResponse resp = ctx.getAllExecutions(null).get(); + for (Execution e : resp.getTrades()) System.out.println(e); + } + } +} +``` + + + + +```rust +use std::sync::Arc; +use longbridge::{oauth::OAuthBuilder, trade::TradeContext, Config}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open this URL to authorize: {url}")).await?; + let config = Arc::new(Config::from_oauth(oauth)); + let (ctx, _) = TradeContext::new(config); + let resp = ctx.all_executions(None).await?; + println!("{:?}", resp); + Ok(()) +} +``` + + + + +```cpp +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace longbridge; +using namespace longbridge::trade; + +static void +run(const OAuth& oauth) +{ + Config config = Config::from_oauth(oauth); + TradeContext ctx = TradeContext::create(config); + + ctx.all_executions(std::nullopt, [](auto res) { + if (!res) { std::cout << "failed" << std::endl; return; } + for (const auto& e : res->trades) std::cout << e.order_id << std::endl; + }); +} + +int main(int argc, char const* argv[]) { +#ifdef WIN32 + SetConsoleOutputCP(CP_UTF8); +#endif + + const std::string client_id = "your-client-id"; + OAuthBuilder(client_id).build( + [](const std::string& url) { + std::cout << "Open this URL to authorize: " << url << std::endl; + }, + [](auto res) { + if (!res) { + std::cout << "authorization failed: " << *res.status().message() << std::endl; + return; + } + run(*res); + }); + + std::cin.get(); + return 0; +} +``` + + + + +```go +package main + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/longbridge/openapi-go/config" + "github.com/longbridge/openapi-go/oauth" + "github.com/longbridge/openapi-go/trade" +) + +func main() { + o := oauth.New("your-client-id"). + OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) }) + if err := o.Build(context.Background()); err != nil { + log.Fatal(err) + } + conf, err := config.New(config.WithOAuthClient(o)) + if err != nil { + log.Fatal(err) + } + tctx, err := trade.NewFromCfg(conf) + if err != nil { + log.Fatal(err) + } + defer tctx.Close() + start := time.Date(2022, 5, 9, 0, 0, 0, 0, time.UTC) + end := time.Date(2022, 5, 12, 0, 0, 0, 0, time.UTC) + resp, err := tctx.AllExecutions(context.Background(), &trade.GetAllExecutions{ + Symbol: "700.HK", + StartAt: start, + EndAt: end, + }) + if err != nil { + log.Fatal(err) + } + for _, e := range resp.Trades { + fmt.Println(e.OrderId) + } +} +``` + + + + ## Response ### Response Headers