提交網格訂單
提交網格策略訂單。網格以 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 |