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
| Term | Description |
|---|---|
| Tick size | The minimum price increment. All order prices must be a multiple of the tick size. |
| Lot size | The minimum order quantity increment. Order sizes must be a multiple of the lot size. |
| Minimum order size | The 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 figures | Prices 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:
| Market | szDecimals | Lot Size | Max Leverage |
|---|---|---|---|
| BTC | 5 | 0.00001 | 50x |
| ETH | 4 | 0.0001 | 50x |
| SOL | 2 | 0.01 | 20x |
Price Rules for Perpetuals
Perpetual prices must have at most 5 significant figures:
| Example Price | Valid | Reason |
|---|---|---|
"67432" | Yes | 5 significant figures |
"67430" | Yes | 4 significant figures |
"3521.2" | Yes | 5 significant figures |
"67432.12" | No | 7 significant figures |
"142.853" | No | 6 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:
| Token | szDecimals | weiDecimals | Lot Size |
|---|---|---|---|
| BTC | 8 | 8 | 0.00000001 |
| USDC | 6 | 6 | 0.000001 |
| ETH | 5 | 18 | 0.00001 |
Validation Rules
- Size must be a multiple of lot size. An order for
0.01500BTC perp (szDecimals=5) is valid;0.000001exceeds the allowed decimals and is rejected. - Size must meet the minimum order size. Orders below the market minimum are rejected.
- Price must respect significant figure constraints. Prices with more than 5 significant figures are rejected.
- 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.