Submit Grid Order
Submit a grid strategy order. The grid places buy orders as the price falls and sell orders as it rises, within the [lower_limit_price, upper_limit_price] band anchored to submitted_base_price.
Before using grid trading you must record the strategy risk-disclosure consent once — see Submit Strategy Questionnaire.
# Submit a percent-triggered grid on 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
# Validate the rule without submitting
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 | Security symbol, ticker.region format, example: 700.HK |
| settlement_currency | string | YES | Settlement currency, example: HKD |
| grid_trading_rule | object | YES | The grid rule. Fields below. |
grid_trading_rule
| Name | Type | Required | Description |
|---|---|---|---|
| submitted_base_price | string | YES | Base price the grid is anchored to |
| upper_limit_price | string | YES | Upper price bound |
| lower_limit_price | string | YES | Lower price bound |
| trigger_price_type | int32 | YES | How trigger thresholds are interpreted Enum Value: 1 - spread (absolute)2 - percent |
| trigger_spread_up | string | NO | Upward trigger spread, required when trigger_price_type is 1 |
| trigger_spread_down | string | NO | Downward trigger spread, required when trigger_price_type is 1 |
| trigger_percent_up | string | NO | Upward trigger percent, required when trigger_price_type is 2 |
| trigger_percent_down | string | NO | Downward trigger percent, required when trigger_price_type is 2 |
| trigger_quantity | string | YES | Quantity per trigger |
| upper_limit_quantity | string | YES | Quantity handled when the upper bound is reached |
| lower_limit_quantity | string | YES | Quantity handled when the lower bound is reached |
| time_in_force | int32 | YES | Time in force Enum Value: 0 - Day1 - GTC (Good-Til-Canceled)6 - GTD (Good-Til-Date) |
| expire_time | int64 | NO | Expiry time (Unix timestamp, in seconds), required when time_in_force is 6 (GTD) |
| upper_limit_event | int32 | NO | Action when the upper bound is reached Enum Value: 1 - ignore (keep running)2 - close position at last price |
| lower_limit_event | int32 | NO | Action when the lower bound is reached Enum Value: 1 - ignore (keep running)2 - close position at last price |
| trigger_sell_depth | int32 | NO | Sell-side order-book depth (-5 ~ 5). 0 = use grid_order_type_up instead of a depth level |
| trigger_buy_depth | int32 | NO | Buy-side order-book depth (-5 ~ 5). 0 = use grid_order_type_down instead of a depth level |
| grid_order_type_up | string | NO | Sell-side order type when trigger_sell_depth is 0Enum Value: GMO / GLO / GTG |
| grid_order_type_down | string | NO | Buy-side order type when trigger_buy_depth is 0Enum Value: GMO / GLO / GTG |
| multiple_trigger | boolean | NO | Whether a single grid level may trigger multiple times |
| support_shortsell | boolean | NO | Whether short selling is allowed |
| rth | int32 | NO | Regular-trading-hours flag (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 | The grid order was submitted successfully. | None |
| 400 | The submission was rejected with an incorrect request parameter. | None |