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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions docs/en/docs/trade/execution/all_executions.md
Original file line number Diff line number Diff line change
@@ -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`.

<SDKLinks module="trade" klass="TradeContext" method="all_executions" />

## Request

<table className="http-basic">
<tbody>
<tr><td className="http-basic-key">HTTP Method</td><td>GET</td></tr>
<tr><td className="http-basic-key">HTTP URL</td><td>/v3/trade/execution/all </td></tr>
</tbody>
</table>

### 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`.<br/><br/> 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`. <br/><br/> 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 |

<aside className="success">
</aside>

## Schemas

### all_executions_rsp

<a id="schemaall_executions_rsp"></a>
<a id="schemaall_executions_rsp"></a>

| Name | Type | Required | Description |
| --------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| has_more | boolean | true | has more orders record.<br/><br/>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<br/><br/> **Enum Value:**<br/> `Buy`<br/> `Sell` |
2 changes: 1 addition & 1 deletion docs/en/docs/trade/order/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ longbridge order sell TSLA.US 100 --price 260.00
| trailing_percent | string | NO | Trailing percent<br/><br/> `TSLPPCT` Order Required |
| expire_date | string | NO | Long term order expire date, format `YYYY-MM-DD`, example: `2022-12-05`<br/><br/> Required when `time_in_force` is `GTD` |
| side | string | YES | Order Side<br/><br/> **Enum Value:**<br/> `Buy`<br/> `Sell` |
| outside_rth | string | NO | Enable or disable outside regular trading hours<br/><br/> **Enum Value:**<br/> `RTH_ONLY` - regular trading hour only<br/> `ANY_TIME` - any time<br/> `OVERNIGHT` - Overnight |
| outside_rth | string | NO | Enable or disable outside regular trading hours<br/><br/> **Enum Value:**<br/> `RTH_ONLY` - regular trading hour only<br/> `ANY_TIME` - any time<br/> `OVERNIGHT` - Overnight<br/> `OPTION_PRE_MARKET` - Overnight option |
| time_in_force | string | YES | Time in force Type<br/><br/> **Enum Value:**<br/> `Day` - Day Order<br/> `GTC` - Good Til Canceled Order<br/> `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. <br/>Negative numbers indicate bid levels (e.g., -1 means best bid level 1),<br/>positive numbers indicate ask levels (e.g., 1 means best ask level 1).<br/>When set to 0, the `limit_offset` parameter takes effect.<br/>Valid for `TSLPAMT` / `TSLPPCT` orders. |
Expand Down
5 changes: 4 additions & 1 deletion docs/en/docs/trade/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sidebar_position: 1
</thead>
<tbody>
<tr>
<td rowspan="7">Trade</td>
<td rowspan="8">Trade</td>
<td><a href="./order/submit">Submit Order</a></td>
</tr>
<tr>
Expand All @@ -37,6 +37,9 @@ sidebar_position: 1
<tr>
<td><a href="./execution/history_executions">Get History Executions</a></td>
</tr>
<tr>
<td><a href="./execution/all_executions">Get All Executions</a></td>
</tr>
<tr>
<td rowspan="4">Asset</td>
<td><a href="./asset/account">Get Account Balance </a></td>
Expand Down
96 changes: 96 additions & 0 deletions docs/zh-CN/docs/trade/execution/all_executions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
slug: all_executions
sidebar_position: 3
title: 全部成交明细
language_tabs: false
toc_footers: []
includes: []
search: true
highlight_theme: ''
headingLevel: 2
---

该接口用于获取订单的成交明细,包括买入和卖出的成交记录,同时支持当日成交和历史成交查询。相比当日/历史成交接口,每条记录额外返回买卖方向 `side`。

<SDKLinks module="trade" klass="TradeContext" method="all_executions" />

## Request

<table className="http-basic">
<tbody>
<tr><td className="http-basic-key">HTTP Method</td><td>GET</td></tr>
<tr><td className="http-basic-key">HTTP URL</td><td>/v3/trade/execution/all </td></tr>
</tbody>
</table>

### 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`。<br/><br/>开始时间为空时,默认为结束时间或当前时间前九十天。 |
| end_at | string | NO | 结束时间,格式为时间戳 (秒),例如:`1650410999`。<br/><br/>结束时间为空时,默认为开始时间后九十天或当前时间。 |
| 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 |

<aside className="success">
</aside>

## Schemas

### all_executions_rsp

<a id="schemaall_executions_rsp"></a>
<a id="schemaall_executions_rsp"></a>

| Name | Type | Required | Description |
| --------------- | -------- | -------- | --------------------------------------------------------------------- |
| has_more | boolean | true | 是否有更多记录。<br/><br/>单次查询最多返回 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 | 买卖方向<br/><br/> **可选值:**<br/> `Buy` - 买入<br/> `Sell` - 卖出 |
2 changes: 1 addition & 1 deletion docs/zh-CN/docs/trade/order/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ longbridge order sell TSLA.US 100 --price 260.00
| trailing_percent | string | NO | 跟踪涨跌幅,单位为百分比,例如 "2.5" 表示 "2.5%"<br/><br/> `TSLPPCT` 订单必填 |
| expire_date | string | NO | 长期单过期时间,格式为 `YYYY-MM-DD`, 例如:`2022-12-05`<br/><br/> time_in_force 为 `GTD` 时必填 |
| side | string | YES | 买卖方向<br/><br/> **可选值:**<br/> `Buy` - 买入<br/> `Sell` - 卖出 |
| outside_rth | string | NO | 是否允许盘前盘后,美股必填<br/><br/> **可选值:**<br/> `RTH_ONLY` - 不允许盘前盘后<br/> `ANY_TIME` - 允许盘前盘后<br/> `OVERNIGHT` - 夜盘 |
| outside_rth | string | NO | 是否允许盘前盘后,美股必填<br/><br/> **可选值:**<br/> `RTH_ONLY` - 不允许盘前盘后<br/> `ANY_TIME` - 允许盘前盘后<br/> `OVERNIGHT` - 夜盘<br/> `OPTION_PRE_MARKET` - 夜盘期权 |
| time_in_force | string | YES | 订单有效期类型<br/><br/> **可选值:**<br/> `Day` - 当日有效<br/> `GTC` - 撤单前有效<br/> `GTD` - 到期前有效 |
| remark | string | NO | 备注 (最大 64 字符) |
| limit_depth_level | int32 | NO | 指定买卖档位,取值范围为 -5 ~ 0 ~ 5,负数代表买盘档位(如 -1 表示买一),<br/>正数代表卖盘档位(如 1 表示卖一),为 0 时 limit_offset 参数生效<br/>`TSLPAMT` / `TSLPPCT` 订单有效 |
Expand Down
5 changes: 4 additions & 1 deletion docs/zh-CN/docs/trade/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sidebar_position: 1
</thead>
<tbody>
<tr>
<td rowspan="7">交易</td>
<td rowspan="8">交易</td>
<td><a href="./order/submit">委托下单</a></td>
</tr>
<tr>
Expand All @@ -38,6 +38,9 @@ sidebar_position: 1
<tr>
<td><a href="./execution/history_executions">获取历史成交明细</a></td>
</tr>
<tr>
<td><a href="./execution/all_executions">获取全部成交明细</a></td>
</tr>
<tr>
<td rowspan="4">资产</td>
<td><a href="./asset/account">获取账户资金信息</a></td>
Expand Down
Loading