Grid Trading Overview
Grid trading is an automated strategy that buys as the price falls and sells as it rises within a price band anchored to a base price. It profits from oscillation: each downward step places a buy, each upward step places a sell, and the accumulated spread becomes realized profit. The Grid Trading API lets you submit, monitor, adjust, and cancel grid strategies programmatically.
How it works
A grid is defined by a base price and a price band, plus rules for when and how much to trade at each step.
- Base price —
submitted_base_priceis the anchor the grid is centered on. Trigger levels are measured relative to this price. - Upper / lower bounds —
upper_limit_priceandlower_limit_pricemark the top and bottom of the band. The grid runs only inside[lower_limit_price, upper_limit_price]. - Trigger by percent vs. spread —
trigger_price_typedecides how the step size is interpreted:1= spread (an absolute price difference,trigger_spread_up/trigger_spread_down),2= percent (a percentage of the base price,trigger_percent_up/trigger_percent_down). - Per-trigger quantity —
trigger_quantityis the amount bought or sold each time a level triggers.upper_limit_quantityandlower_limit_quantityare the amounts handled when the band's upper or lower bound is reached. - Upper / lower limit events —
upper_limit_eventandlower_limit_eventdecide what happens at the bounds:1= ignore (keep the grid running),2= close the position at the last price. - Grid order types — when the corresponding order-book depth (
trigger_sell_depth/trigger_buy_depth) is0,grid_order_type_up/grid_order_type_downdecide the order type:GMO(grid market order),GLO(grid limit order),GTG(grid touch-to-go). - Time in force —
time_in_forcecontrols how long the grid stays active:0= Day,1= GTC (Good-Til-Canceled),6= GTD (Good-Til-Date, paired withexpire_time).
Prerequisites
Grid trading requires the Trade permission on your access token. You must also record the strategy risk-disclosure consent once before submitting any grid order — see Submit Strategy Questionnaire. You can check whether the consent has been recorded via the strategy_granted field on Grid Symbol Info.
Typical workflow
- Record the risk-disclosure consent once — Submit Strategy Questionnaire.
- Fetch the security's grid info (lot size, last price, authorization) — Grid Symbol Info.
- Submit the grid strategy — Submit Grid Order.
- List and inspect running grids — List Grid Orders and Grid Order Detail.
- Review what the grid has triggered — Trigger History.
- Adjust or stop the grid — Suspend, Restart, Replace, or Cancel.
Quickstart (CLI)
# Record the one-time strategy risk-disclosure consent
longbridge grid questionnaire
# Check the security's grid info (lot size, last price, authorization)
longbridge grid info 700.HK
# 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
# List your grid orders
longbridge grid