Skip to Content

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 pricesubmitted_base_price is the anchor the grid is centered on. Trigger levels are measured relative to this price.
  • Upper / lower boundsupper_limit_price and lower_limit_price mark the top and bottom of the band. The grid runs only inside [lower_limit_price, upper_limit_price].
  • Trigger by percent vs. spreadtrigger_price_type decides 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 quantitytrigger_quantity is the amount bought or sold each time a level triggers. upper_limit_quantity and lower_limit_quantity are the amounts handled when the band's upper or lower bound is reached.
  • Upper / lower limit eventsupper_limit_event and lower_limit_event decide 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) is 0, grid_order_type_up / grid_order_type_down decide the order type: GMO (grid market order), GLO (grid limit order), GTG (grid touch-to-go).
  • Time in forcetime_in_force controls how long the grid stays active: 0 = Day, 1 = GTC (Good-Til-Canceled), 6 = GTD (Good-Til-Date, paired with expire_time).

Prerequisites

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

  1. Record the risk-disclosure consent once — Submit Strategy Questionnaire.
  2. Fetch the security's grid info (lot size, last price, authorization) — Grid Symbol Info.
  3. Submit the grid strategy — Submit Grid Order.
  4. List and inspect running grids — List Grid Orders and Grid Order Detail.
  5. Review what the grid has triggered — Trigger History.
  6. Adjust or stop the grid — Suspend, Restart, Replace, or Cancel.

Quickstart (CLI)

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