修改网格订单
修改已存在的网格订单规则。提交的 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 |