For DevelopersAPITick & Lot Size

Tick Size and Lot Size

GX Exchange enforces minimum price increments (tick sizes) and minimum quantity increments (lot sizes) for every market. Orders that do not conform to these constraints are rejected.

Definitions

TermDescription
Tick sizeThe minimum price increment. All order prices must be a multiple of the tick size.
Lot sizeThe minimum order quantity increment. Order sizes must be a multiple of the lot size.
Minimum order sizeThe smallest allowable order quantity for a given market.
Size decimals (szDecimals)The number of decimal places allowed for order sizes. The lot size is 10^(-szDecimals).
Significant figuresPrices are limited to 5 significant figures.

Perpetual Markets

Perpetual market parameters are returned by the meta endpoint:

POST /info
{ "type": "meta" }

The szDecimals field defines the lot size precision for each market:

MarketszDecimalsLot SizeMax Leverage
BTC50.0000150x
ETH40.000150x
SOL20.0120x

Price Rules for Perpetuals

Perpetual prices must have at most 5 significant figures:

Example PriceValidReason
"67432"Yes5 significant figures
"67430"Yes4 significant figures
"3521.2"Yes5 significant figures
"67432.12"No7 significant figures
"142.853"No6 significant figures

Spot Markets

Spot market parameters are returned by the spotMeta endpoint:

POST /info
{ "type": "spotMeta" }

Each token in the tokens array includes szDecimals and weiDecimals:

TokenszDecimalsweiDecimalsLot Size
BTC880.00000001
USDC660.000001
ETH5180.00001

Validation Rules

  1. Size must be a multiple of lot size. An order for 0.01500 BTC perp (szDecimals=5) is valid; 0.000001 exceeds the allowed decimals and is rejected.
  2. Size must meet the minimum order size. Orders below the market minimum are rejected.
  3. Price must respect significant figure constraints. Prices with more than 5 significant figures are rejected.
  4. Both price and size are transmitted as strings. Use decimal arithmetic to avoid floating-point rounding errors.

Computing Valid Prices

function roundToSignificantFigures(price: number, sigFigs: number = 5): string {
  if (price === 0) return "0";
  const magnitude = Math.floor(Math.log10(Math.abs(price)));
  const factor = Math.pow(10, sigFigs - 1 - magnitude);
  return (Math.round(price * factor) / factor).toString();
}
 
// Examples
roundToSignificantFigures(67432.789);  // "67433"
roundToSignificantFigures(3521.267);   // "3521.3"
roundToSignificantFigures(142.853);    // "142.85"

Computing Valid Sizes

from decimal import Decimal, ROUND_DOWN
 
def round_size(size: float, sz_decimals: int) -> str:
    """Round a size down to the allowed number of decimal places."""
    quantize_str = "1." + "0" * sz_decimals if sz_decimals > 0 else "1"
    return str(Decimal(str(size)).quantize(Decimal(quantize_str), rounding=ROUND_DOWN))
 
# Examples
round_size(0.012345, 5)   # "0.01234"
round_size(1.567, 2)      # "1.56"
round_size(0.1, 4)        # "0.1000"
function roundSize(size: number, szDecimals: number): string {
  const factor = Math.pow(10, szDecimals);
  return (Math.floor(size * factor) / factor).toFixed(szDecimals);
}
 
// Examples
roundSize(0.012345, 5);  // "0.01234"
roundSize(1.567, 2);     // "1.56"

Error Responses

If an order violates tick or lot size constraints:

{
  "status": "err",
  "response": "Invalid size: 0.0000001 does not conform to szDecimals 5 for BTC"
}
{
  "status": "err",
  "response": "Price out of range"
}

Best Practice

Query the meta and spotMeta endpoints at startup and cache the szDecimals values. Validate all prices and sizes client-side before submitting orders to avoid unnecessary rejected requests.