Trade

Submit Grid Order

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

Authorization

Signed mode: every request is signed with your App Key/Secret. Header set:

NameTypeRequiredDescription
Authorizationstring · headerRequiredThe account Access Token from the OpenAPI dashboard — passed as the raw token (no Bearer prefix) and included in the signature calculation.
X-Api-Keystring · headerRequiredYour App Key.
X-Timestampstring · headerRequiredRequest timestamp in seconds (Unix epoch).
X-Api-Signaturestring · headerRequiredHMAC-SHA256 signature. Format: HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=.

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.

>_ CLI
# 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-run

Request

Request body

NameTypeRequiredDescription
symbolstringRequiredSecurity symbol, `ticker.region` format, example: `700.HK`
settlement_currencystringRequiredSettlement currency, example: `HKD`
grid_trading_ruleobjectRequiredThe grid rule. Fields below.
grid_trading_rule.submitted_base_pricestringRequiredBase price the grid is anchored to
grid_trading_rule.upper_limit_pricestringRequiredUpper price bound
grid_trading_rule.lower_limit_pricestringRequiredLower price bound
grid_trading_rule.trigger_price_typeintegerRequiredHow trigger thresholds are interpreted. **Enum Value:**, `1` - spread (absolute), `2` - percent
grid_trading_rule.trigger_spread_upstringOptionalUpward trigger spread, required when `trigger_price_type` is `1`
grid_trading_rule.trigger_spread_downstringOptionalDownward trigger spread, required when `trigger_price_type` is `1`
grid_trading_rule.trigger_percent_upstringOptionalUpward trigger percent, required when `trigger_price_type` is `2`
grid_trading_rule.trigger_percent_downstringOptionalDownward trigger percent, required when `trigger_price_type` is `2`
grid_trading_rule.trigger_buy_quantitystringRequiredBuy quantity per trigger
grid_trading_rule.trigger_sell_quantitystringRequiredSell quantity per trigger
grid_trading_rule.time_in_forceintegerRequiredTime in force. **Enum Value:**, `0` - Day, `1` - GTC (Good-Til-Canceled), `6` - GTD (Good-Til-Date)
grid_trading_rule.expire_timeintegerOptionalExpiry time (Unix timestamp, in seconds), required when `time_in_force` is `6` (GTD)
grid_trading_rule.upper_limit_eventintegerOptionalAction when the upper bound is reached. **Enum Value:**, `1` - ignore (keep running), `2` - close position at last price
grid_trading_rule.lower_limit_eventintegerOptionalAction when the lower bound is reached. **Enum Value:**, `1` - ignore (keep running), `2` - close position at last price
grid_trading_rule.trigger_sell_depthintegerOptionalSell-side order-book depth (-5 ~ 5). `0` = use `grid_order_type_up` instead of a depth level
grid_trading_rule.trigger_buy_depthintegerOptionalBuy-side order-book depth (-5 ~ 5). `0` = use `grid_order_type_down` instead of a depth level
grid_trading_rule.grid_order_type_upstringOptionalSell-side order type when `trigger_sell_depth` is `0`. **Enum Value:**, `GMO` / `GLO` / `GTG`
grid_trading_rule.grid_order_type_downstringOptionalBuy-side order type when `trigger_buy_depth` is `0`. **Enum Value:**, `GMO` / `GLO` / `GTG`
grid_trading_rule.multiple_triggerbooleanOptionalWhether a single grid level may trigger multiple times
grid_trading_rule.support_shortsellbooleanOptionalWhether short selling is allowed
grid_trading_rule.rthintegerOptionalRegular-trading-hours flag (`0` / `1` / `2`)

Response

Response JSON example

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

Error code

See the Error Codes page for the full list of error codes.