Trade

Modify Grid Order

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

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=.

Modify an existing grid order's rule. The whole grid_trading_rule is replaced with the one you submit, so pass the complete rule — not just the fields you changed.

>_ 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

Request

Request body

NameTypeRequiredDescription
order_idstringRequiredGrid order ID, example: `764609681686573056`
grid_trading_ruleobjectRequiredThe full grid rule to apply. 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": {}
}

Error code

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