修改網格訂單
修改已存在的網格訂單規則。提交的 grid_trading_rule 會整體替換原有規則,因此需要傳入完整的規則,而不是僅傳改動的欄位。
# 修改網格訂單的基準價、上下邊界價格和數量
longbridge grid replace 764609681686573056 --base-price 305 --upper-price 360 --lower-price 240 --trigger-type percent --trigger-up 2 --trigger-down 2 --quantity 100 --upper-quantity 200 --lower-quantity 100 --order-type GMO --tif gtc
# 僅校驗新規則而不實際應用
longbridge grid replace 764609681686573056 --base-price 305 --upper-price 360 --lower-price 240 --trigger-type percent --trigger-up 2 --trigger-down 2 --quantity 100 --upper-quantity 200 --lower-quantity 100 --order-type GMO --tif gtc --dry-runSDK Links
Python | longbridge.openapi.GridContext.replace |
Rust | longbridge::grid::GridContext#replace |
Node.js | GridContext#replace |
Java | GridContext.getReplace |
C++ | longbridge::grid::GridContext::replace |
Request
| HTTP Method | POST |
| HTTP URL | /v1/gridtrading/replace |
Parameters
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description |
|---|---|---|---|
| order_id | string | YES | 網格訂單 ID,例如:764609681686573056 |
| grid_trading_rule | object | YES | 要應用的完整網格規則,欄位見下。 |
grid_trading_rule
| Name | Type | Required | Description |
|---|---|---|---|
| submitted_base_price | string | YES | 網格錨定的基準價 |
| upper_limit_price | string | YES | 價格上邊界 |
| lower_limit_price | string | YES | 價格下邊界 |
| trigger_price_type | int32 | YES | 觸發閾值的計算方式 可選值: 1 - 價差(絕對值)2 - 百分比 |
| trigger_spread_up | string | NO | 向上觸發價差,trigger_price_type 為 1 時必填 |
| trigger_spread_down | string | NO | 向下觸發價差,trigger_price_type 為 1 時必填 |
| trigger_percent_up | string | NO | 向上觸發百分比,trigger_price_type 為 2 時必填 |
| trigger_percent_down | string | NO | 向下觸發百分比,trigger_price_type 為 2 時必填 |
| trigger_quantity | string | YES | 每次觸發的數量 |
| upper_limit_quantity | string | YES | 到達上邊界時處理的數量 |
| lower_limit_quantity | string | YES | 到達下邊界時處理的數量 |
| time_in_force | int32 | YES | 訂單有效期類型 可選值: 0 - 當日有效1 - GTC(撤單前有效)6 - GTD(到期前有效) |
| expire_time | int64 | NO | 到期時間(Unix 時間戳,單位秒),time_in_force 為 6(GTD)時必填 |
| upper_limit_event | int32 | NO | 到達上邊界時的動作 可選值: 1 - 忽略(保持運行)2 - 以最新價平倉 |
| lower_limit_event | int32 | NO | 到達下邊界時的動作 可選值: 1 - 忽略(保持運行)2 - 以最新價平倉 |
| trigger_sell_depth | int32 | NO | 賣方向盤口檔位(-5 ~ 5)。為 0 時使用 grid_order_type_up 而非檔位 |
| trigger_buy_depth | int32 | NO | 買方向盤口檔位(-5 ~ 5)。為 0 時使用 grid_order_type_down 而非檔位 |
| grid_order_type_up | string | NO | trigger_sell_depth 為 0 時的賣方向訂單類型可選值: GMO / GLO / GTG |
| grid_order_type_down | string | NO | trigger_buy_depth 為 0 時的買方向訂單類型可選值: GMO / GLO / GTG |
| multiple_trigger | boolean | NO | 單個網格檔位是否可多次觸發 |
| support_shortsell | boolean | NO | 是否允許賣空 |
| rth | int32 | NO | 常規交易時段標誌(0 / 1 / 2) |
Request Example
Response
Response Headers
- Content-Type: application/json
Response Example
json
{
"code": 0,
"message": "success",
"data": {}
}Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | 網格訂單修改成功。 | None |
| 400 | 修改被拒絕,請求參數錯誤。 | None |