Skip to main content

Validate Grid Input

Validate spot grid bot parameters before creation. Returns acceptable ranges for each parameter and a check code indicating any validation errors.

info
  • When to call:
    Always call this endpoint before Create Spot Grid Bot to ensure parameters are within valid bounds.

  • check_code:
    SPOT_CHECK_CODE_SUCCESS_UNSPECIFIED (value 0) means all parameters are valid. Any other value identifies the specific parameter that is out of range.

  • Authentication:
    This endpoint does not require authentication (guest mode).

  • Rate limit:
    100 requests per second per IP.

HTTP Request

POST/v5/grid/validate-input

Request Parameters

ParameterRequiredTypeComments
symboltruestringTrading pair symbol, uppercase only (e.g. BTCUSDT)
cell_numbertrueintegerNumber of grid intervals, minimum 2
min_pricetruestringLower bound of the grid price range (decimal string)
max_pricetruestringUpper bound of the grid price range. Must be greater than min_price (decimal string)
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
stop_lossfalsestringStop-loss as absolute price (decimal string)
take_profitfalsestringTake-profit as absolute price (decimal string)
entry_pricefalsestringEntry trigger as absolute price (decimal string)
ts_percentfalsestringTrailing stop callback ratio, range [0, 0.99] (e.g. "0.05" means 5%)
enable_trailingfalsebooleanWhether to enable grid trailing. Requires cell_number >= 5
limit_up_pricefalsestringUpper limit price for grid trailing (decimal string)

Response Parameters

ParameterTypeComments
status_codeinteger0 or 200 = success
debug_msgstringDebug message (testnet only)
check_codestringValidation result code. SPOT_CHECK_CODE_SUCCESS_UNSPECIFIED = OK. See check code table below
investmentobjectAcceptable range for total investment (from / to, decimal strings)
profitobjectAcceptable per-grid profit rate range as decimal ratio (from / to)
cell_numberobjectAcceptable grid count range (from / to)
min_priceobjectAcceptable lower price bound range (from / to)
max_priceobjectAcceptable upper price bound range (from / to)
stop_lossobjectAcceptable stop-loss price range (from / to)
take_profitobjectAcceptable take-profit price range (from / to)
entry_priceobjectAcceptable entry price range (from / to)
base_investmentobjectAcceptable base token investment range (from / to)
cell_distancestringGrid interval distance in quote token price units (decimal string)
ts_percentobjectAcceptable trailing stop ratio range (from / to)
limit_up_priceobjectAcceptable trailing upper limit price range (from / to)

Check Code Values

check_codeDescription
SPOT_CHECK_CODE_SUCCESS_UNSPECIFIEDOK — no error
SPOT_CHECK_CODE_LOW_PRICE_TOO_LOWmin_price too low
SPOT_CHECK_CODE_LOW_PRICE_TOO_HIGHmin_price too high
SPOT_CHECK_CODE_HIGH_PRICE_TOO_LOWmax_price too low
SPOT_CHECK_CODE_HIGH_PRICE_TOO_HIGHmax_price too high
SPOT_CHECK_CODE_GRID_NO_TOO_LOWcell_number too few
SPOT_CHECK_CODE_GRID_NO_TOO_HIGHcell_number too many
SPOT_CHECK_CODE_INVESTMENT_TOO_LOWInvestment too low
SPOT_CHECK_CODE_INVESTMENT_TOO_HIGHInvestment too high
SPOT_CHECK_CODE_TP_TOO_LOWTake-profit too low
SPOT_CHECK_CODE_TP_TOO_HIGHTake-profit too high
SPOT_CHECK_CODE_SL_TOO_LOWStop-loss too low
SPOT_CHECK_CODE_SL_TOO_HIGHStop-loss too high
SPOT_CHECK_CODE_EP_TOO_LOWEntry price too low
SPOT_CHECK_CODE_EP_TOO_HIGHEntry price too high
SPOT_CHECK_CODE_TS_PERCENT_TOO_LOWTrailing stop percentage too low
SPOT_CHECK_CODE_TS_PERCENT_TOO_HIGHTrailing stop percentage too high
SPOT_CHECK_CODE_TP_TOO_LOW_THAN_MARKETTake-profit too low relative to market price
SPOT_CHECK_CODE_SL_TOO_HIGH_THAN_MARKETStop-loss too high relative to market price
SPOT_CHECK_CODE_LIMIT_UP_PRICE_TOO_LOWlimit_up_price too low
SPOT_CHECK_CODE_LIMIT_UP_PRICE_TOO_HIGHlimit_up_price too high
SPOT_CHECK_CODE_CAN_NOT_ENABLE_TRAILING_UPcell_number < 5, trailing not allowed
SPOT_CHECK_CODE_ENTRY_PRICE_FORBIDDEN_TRAILING_UPEntry price out of grid range, trailing not allowed
SPOT_CHECK_CODE_LAST_PRICE_FORBIDDEN_TRAILING_UPMarket price out of grid range, trailing not allowed
SPOT_CHECK_CODE_INVESTMENT_FORBIDDEN_TRAILING_UPInvestment too small for trailing

Request Example

POST /v5/grid/validate-input HTTP/1.1
Host: api-testnet.bybit.com
Content-Type: application/json

{
"symbol": "MNTUSDT",
"max_price": "1.2",
"min_price": "0.3",
"quote_investment": "",
"base_investment": "300",
"invest_mode": 1,
"cell_number": 66,
"entry_price": "0.4"
}

Response Example

{
"retCode": 0,
"retMsg": "",
"result": {
"status_code": 200,
"debug_msg": "",
"investment": {
"from": "0",
"to": "0"
},
"profit": {
"from": "0.0114",
"to": "0.0453"
},
"cell_number": {
"from": "2",
"to": "562"
},
"min_price": {
"from": "0.1568",
"to": "3.92"
},
"max_price": {
"from": "0.3012",
"to": "40"
},
"stop_loss": {
"from": "0",
"to": "0.3"
},
"take_profit": {
"from": "1.2",
"to": ""
},
"entry_price": {
"from": "0.2352",
"to": "0.784"
},
"cell_distance": "0.0136",
"check_code": "SPOT_CHECK_CODE_SUCCESS_UNSPECIFIED",
"base_investment": {
"from": "228.36",
"to": "1366590.08"
},
"ts_percent": {
"from": "0.03",
"to": "0.99"
},
"limit_up_price": {
"from": "1.2112",
"to": "3.9065"
}
},
"retExtInfo": {},
"time": 1774513367099
}