提交网格订单
提交网格策略订单。网格以 submitted_base_price 为基准价,在 [lower_limit_price, upper_limit_price] 区间内,价格下跌时挂买单、价格上涨时挂卖单。
使用网格交易前,你需要先记录一次策略风险揭示的同意确认,详见提交策略问卷。
# 在 700.HK 上提交按百分比触发的网格
longbridge grid submit 700.HK --currency HKD --base-price 300 --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 submit 700.HK --currency HKD --base-price 300 --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.submit |
Rust | longbridge::grid::GridContext#submit |
Node.js | GridContext#submit |
Java | GridContext.getSubmit |
C++ | longbridge::grid::GridContext::submit |
Request
| HTTP Method | POST |
| HTTP URL | /v1/gridtrading/submit |
Parameters
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | string | YES | 标的代码,ticker.region 格式,例如:700.HK |
| settlement_currency | string | YES | 结算货币,例如:HKD |
| 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 - spread(绝对价差)2 - percent(百分比) |
| 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 - Day(当日有效)1 - GTC(撤单前有效)6 - GTD(到期前有效) |
| expire_time | int64 | NO | 到期时间(Unix 时间戳,单位秒),time_in_force 为 6(GTD)时必填 |
| upper_limit_event | int32 | NO | 达到上边界时的动作 可选值: 1 - ignore(继续运行)2 - 按最新价平仓 |
| lower_limit_event | int32 | NO | 达到下边界时的动作 可选值: 1 - ignore(继续运行)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": {
"order_id": "764609681686573056"
}
}Response Status
| Status | Description | Schema |
|---|---|---|
| 200 | 网格订单提交成功。 | None |
| 400 | 下单被拒绝,请求参数错误。 | None |