Skip to main content

Create Grid Bot

Create a new spot grid trading bot with a specified trading pair, price range, grid count, and investment amount.

info
  • Prerequisites:
    Call Validate Spot Grid Input before this endpoint to ensure parameters are within valid ranges.
    User must be authenticated and pass KYC/compliance checks.

  • Investment mode (invest_mode):
    0: Quote only (default) — invest in quote token (e.g. USDT)
    1: Base only — invest in base token (e.g. BTC)
    2: Base + Quote — split investment across both tokens

  • Grid trailing (enable_trailing):
    When enabled, the grid automatically shifts as price moves. Requires cell_number >= 5.

  • Response grid_id:
    Returned on success. Use this ID for subsequent Get Detail and Close operations.

  • Rate limit:
    3 requests per second per UID.

  • Subject to compliance wall and KYC verification.
    If the user is banned (status_code=421), ban_reason_text provides a localized explanation.

HTTP Request

POST/v5/grid/create-grid

Request Parameters

ParameterRequiredTypeComments
symboltruestringTrading pair symbol, uppercase only (e.g. BTCUSDT)
max_pricetruestringUpper bound of the grid price range (decimal string)
min_pricetruestringLower bound of the grid price range (decimal string)
cell_numbertrueintegerNumber of grid intervals, minimum 2
invest_modefalseintegerInvestment mode. 0: Quote only (default), 1: Base only, 2: Base + Quote
base_investmentfalsestringInvestment in base token (decimal string). Required when invest_mode is 1 or 2
quote_investmentfalsestringInvestment in quote token (decimal string). Required when invest_mode is 0 or 2
entry_pricefalsestringEntry trigger price (decimal string). Bot activates when market price reaches this level
stop_loss_pricefalsestringStop-loss trigger price (decimal string)
take_profit_pricefalsestringTake-profit trigger price (decimal string)
ts_percentfalsestringTrailing stop callback ratio, range [0, 0.99] (e.g. "0.05" means 5%)
enable_trailingfalsebooleanEnable grid trailing (auto-shift). Requires cell_number >= 5. Default: false
limit_up_pricefalsestringUpper limit price for grid trailing (decimal string), usd when "enable_trailing"=true

Response Parameters

ParameterTypeComments
status_codeinteger200 = success, 421 = user banned
grid_idintegerCreated grid bot ID. Use for subsequent queries and close operations
ban_reason_textstringBan reason in user's locale. Returned only when status_code=421
debug_msgstringDebug message (testnet only)

Request Example

POST /v5/grid/create-grid HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1672211928338
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json

{
"symbol": "MNTUSDT",
"max_price": "1.0968",
"min_price": "0.3656",
"quote_investment": "200",
"base_investment": "",
"invest_mode": 0,
"cell_number": 50
}

Response Example

{
"retCode": 0,
"retMsg": "",
"result": {
"status_code": 200,
"debug_msg": "",
"grid_id": "612340768081708828",
"ban_reason_text": ""
},
"retExtInfo": {},
"time": 1774513139729
}