交易

修改网格订单

POSThttps://openapi.longbridge.com/v1/gridtrading/replace

鉴权

签名方式:每个请求用 App Key / Secret 签名。请求头如下:

名称类型必填说明
Authorizationstring · header必填OpenAPI 后台 上的账户 Access Token,作为原始 token 传入(不带 Bearer 前缀),并参与签名计算。
X-Api-Keystring · header必填你的 App Key。
X-Timestampstring · header必填请求时间戳,单位秒(Unix 时间)。
X-Api-Signaturestring · header必填HMAC-SHA256 签名。格式:HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=。

修改已存在的网格订单规则。提交的 grid_trading_rule 会整体替换原有规则,因此需要传入完整的规则,而不是仅传改动的字段。

>_ CLI
# Modify a grid order's base/bound prices and quantities
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
# Validate the new rule without applying it
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-run

请求

请求体

名称类型必填说明
order_idstring必填网格订单 ID,例如:`764609681686573056`
grid_trading_ruleobject必填要应用的完整网格规则,字段见下。
grid_trading_rule.submitted_base_pricestring必填网格锚定的基准价
grid_trading_rule.upper_limit_pricestring必填价格上边界
grid_trading_rule.lower_limit_pricestring必填价格下边界
grid_trading_rule.trigger_price_typeinteger必填触发阈值的计算方式。**可选值:**, `1` - 价差(绝对值), `2` - 百分比
grid_trading_rule.trigger_spread_upstring可选向上触发价差,`trigger_price_type` 为 `1` 时必填
grid_trading_rule.trigger_spread_downstring可选向下触发价差,`trigger_price_type` 为 `1` 时必填
grid_trading_rule.trigger_percent_upstring可选向上触发百分比,`trigger_price_type` 为 `2` 时必填
grid_trading_rule.trigger_percent_downstring可选向下触发百分比,`trigger_price_type` 为 `2` 时必填
grid_trading_rule.trigger_buy_quantitystring必填每次触发买入数量
grid_trading_rule.trigger_sell_quantitystring必填每次触发卖出数量
grid_trading_rule.time_in_forceinteger必填订单有效期类型。**可选值:**, `0` - 当日有效,`1` - GTC(撤单前有效), `6` - GTD(到期前有效)
grid_trading_rule.expire_timeinteger可选到期时间(Unix 时间戳,单位秒),`time_in_force` 为 `6`(GTD)时必填
grid_trading_rule.upper_limit_eventinteger可选到达上边界时的动作。**可选值:**, `1` - 忽略(保持运行), `2` - 以最新价平仓
grid_trading_rule.lower_limit_eventinteger可选到达下边界时的动作。**可选值:**, `1` - 忽略(保持运行), `2` - 以最新价平仓
grid_trading_rule.trigger_sell_depthinteger可选卖方向盘口档位(-5 ~ 5)。为 `0` 时使用 `grid_order_type_up` 而非档位
grid_trading_rule.trigger_buy_depthinteger可选买方向盘口档位(-5 ~ 5)。为 `0` 时使用 `grid_order_type_down` 而非档位
grid_trading_rule.grid_order_type_upstring可选`trigger_sell_depth` 为 `0` 时的卖方向订单类型。**可选值:**, `GMO` / `GLO` / `GTG`
grid_trading_rule.grid_order_type_downstring可选`trigger_buy_depth` 为 `0` 时的买方向订单类型。**可选值:**, `GMO` / `GLO` / `GTG`
grid_trading_rule.multiple_triggerboolean可选单个网格档位是否可多次触发
grid_trading_rule.support_shortsellboolean可选是否允许卖空
grid_trading_rule.rthinteger可选常规交易时段标志(`0` / `1` / `2`)

响应

响应 JSON 示例

{
  "code": 0,
  "message": "success",
  "data": {}
}

错误码

参见错误码文档。