From 227db6f25ea7a68d6228bd6bd0ac2897204c6014 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/6] 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 f64a95b2..52852300 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 55ca04ac..2a37de60 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 4fdcc2d4..1f9d93d5 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 347f1c1921216826d9ecab45ea913a30c1aeaa4e 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/6] 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 00000000..cb5e38e9 --- /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 83db47ff..94543b21 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 00000000..23c248df --- /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 60232a1b..ff271067 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 00000000..d5ed53b4 --- /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 b9a084de..3b2d12ee 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 c6d7f0450a47745bf7cba8068a7e6897e549f5f1 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 3/6] 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 cb5e38e9..a50d3f87 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 23c248df..107ccda3 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 d5ed53b4..bbcf3ffa 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 3483ed9a6ed023f8254ec1e26cc3fcd5f651ee35 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 8 Jul 2026 11:31:01 +0800 Subject: [PATCH 4/6] 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 583a4322..fae6bae1 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 9622df1775924fcca36dc69c4c120b4ebcfdd937 Mon Sep 17 00:00:00 2001 From: Sunli Date: Wed, 8 Jul 2026 11:36:42 +0800 Subject: [PATCH 5/6] 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 a50d3f87..c637134f 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 107ccda3..3b76ad9e 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 bbcf3ffa..39dce7b5 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 From 1b58d136fd02484e4065c41cdbfac8c3b2567a1f 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 12:00:02 +0800 Subject: [PATCH 6/6] docs(trade): add side field to execution APIs --- docs/en/docs/trade/execution/all_executions.md | 2 +- docs/en/docs/trade/execution/history_executions.md | 2 ++ docs/en/docs/trade/execution/today_executions.md | 2 ++ docs/zh-CN/docs/trade/execution/all_executions.md | 2 +- docs/zh-CN/docs/trade/execution/history_executions.md | 2 ++ docs/zh-CN/docs/trade/execution/today_executions.md | 2 ++ docs/zh-HK/docs/trade/execution/all_executions.md | 2 +- docs/zh-HK/docs/trade/execution/history_executions.md | 2 ++ docs/zh-HK/docs/trade/execution/today_executions.md | 2 ++ 9 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/en/docs/trade/execution/all_executions.md b/docs/en/docs/trade/execution/all_executions.md index c637134f..144088b7 100644 --- a/docs/en/docs/trade/execution/all_executions.md +++ b/docs/en/docs/trade/execution/all_executions.md @@ -10,7 +10,7 @@ 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`. +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. diff --git a/docs/en/docs/trade/execution/history_executions.md b/docs/en/docs/trade/execution/history_executions.md index 7b9f7bdf..9a5195be 100644 --- a/docs/en/docs/trade/execution/history_executions.md +++ b/docs/en/docs/trade/execution/history_executions.md @@ -256,6 +256,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -292,3 +293,4 @@ func main() { | ∟ 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/execution/today_executions.md b/docs/en/docs/trade/execution/today_executions.md index ddd85ba2..f0962f57 100644 --- a/docs/en/docs/trade/execution/today_executions.md +++ b/docs/en/docs/trade/execution/today_executions.md @@ -237,6 +237,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -274,3 +275,4 @@ func main() { | ∟ 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/zh-CN/docs/trade/execution/all_executions.md b/docs/zh-CN/docs/trade/execution/all_executions.md index 3b76ad9e..c33bfbba 100644 --- a/docs/zh-CN/docs/trade/execution/all_executions.md +++ b/docs/zh-CN/docs/trade/execution/all_executions.md @@ -10,7 +10,7 @@ highlight_theme: '' headingLevel: 2 --- -该接口用于获取订单的成交明细,包括买入和卖出的成交记录,同时支持当日成交和历史成交查询。相比当日/历史成交接口,每条记录额外返回买卖方向 `side`。 +该接口用于获取订单的成交明细,包括买入和卖出的成交记录,同时支持当日成交和历史成交查询。 diff --git a/docs/zh-CN/docs/trade/execution/history_executions.md b/docs/zh-CN/docs/trade/execution/history_executions.md index 549785e3..40b72415 100644 --- a/docs/zh-CN/docs/trade/execution/history_executions.md +++ b/docs/zh-CN/docs/trade/execution/history_executions.md @@ -255,6 +255,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -291,3 +292,4 @@ func main() { | ∟ trade_done_at | string | true | 成交时间,格式为时间戳 (秒) | | ∟ quantity | string | true | 成交数量 | | ∟ price | string | true | 成交价格 | +| ∟ side | string | true | 买卖方向

**可选值:**
`Buy` - 买入
`Sell` - 卖出 | diff --git a/docs/zh-CN/docs/trade/execution/today_executions.md b/docs/zh-CN/docs/trade/execution/today_executions.md index d3747764..60d6639e 100644 --- a/docs/zh-CN/docs/trade/execution/today_executions.md +++ b/docs/zh-CN/docs/trade/execution/today_executions.md @@ -236,6 +236,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -273,3 +274,4 @@ func main() { | ∟ trade_done_at | string | true | 成交时间,格式为时间戳 (秒) | | ∟ quantity | string | true | 成交数量 | | ∟ price | string | true | 成交价格 | +| ∟ side | string | true | 买卖方向

**可选值:**
`Buy` - 买入
`Sell` - 卖出 | diff --git a/docs/zh-HK/docs/trade/execution/all_executions.md b/docs/zh-HK/docs/trade/execution/all_executions.md index 39dce7b5..e97aa645 100644 --- a/docs/zh-HK/docs/trade/execution/all_executions.md +++ b/docs/zh-HK/docs/trade/execution/all_executions.md @@ -10,7 +10,7 @@ highlight_theme: '' headingLevel: 2 --- -該接口用於獲取訂單的成交明細,包括買入和賣出的成交記錄,同時支持當日成交和歷史成交查詢。相比當日/歷史成交接口,每條記錄額外返回買賣方向 `side`。 +該接口用於獲取訂單的成交明細,包括買入和賣出的成交記錄,同時支持當日成交和歷史成交查詢。 diff --git a/docs/zh-HK/docs/trade/execution/history_executions.md b/docs/zh-HK/docs/trade/execution/history_executions.md index 29b619fa..bac057cc 100644 --- a/docs/zh-HK/docs/trade/execution/history_executions.md +++ b/docs/zh-HK/docs/trade/execution/history_executions.md @@ -255,6 +255,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -291,3 +292,4 @@ func main() { | ∟ trade_done_at | string | true | 成交時間,格式為時間戳 (秒) | | ∟ quantity | string | true | 成交數量 | | ∟ price | string | true | 成交價格 | +| ∟ side | string | true | 買賣方向

**可選值:**
`Buy` - 買入
`Sell` - 賣出 | diff --git a/docs/zh-HK/docs/trade/execution/today_executions.md b/docs/zh-HK/docs/trade/execution/today_executions.md index 8b0e7e53..a6a12d98 100644 --- a/docs/zh-HK/docs/trade/execution/today_executions.md +++ b/docs/zh-HK/docs/trade/execution/today_executions.md @@ -236,6 +236,7 @@ func main() { "order_id": "693664675163312128", "price": "388", "quantity": "100", + "side": "Buy", "symbol": "700.HK", "trade_done_at": "1648611351", "trade_id": "693664675163312128-1648611351433741210" @@ -273,3 +274,4 @@ func main() { | ∟ trade_done_at | string | true | 成交時間,格式為時間戳 (秒) | | ∟ quantity | string | true | 成交數量 | | ∟ price | string | true | 成交價格 | +| ∟ side | string | true | 買賣方向

**可選值:**
`Buy` - 買入
`Sell` - 賣出 |