Precision & Decimals
o2 markets use integer values on chain. Clients must scale human-readable prices and quantities before submitting orders.
For market-specific values, fetch Market Data or use Markets.
Market Metadata
Each market includes base and quote asset metadata such as:
- asset ID
- symbol
- decimals
- max precision
- minimum order constraints
Always fetch market metadata from the API rather than hard-coding it.
Price Scaling
Prices are submitted as integer strings. Scale prices using the quote asset decimals and market precision constraints.
Example:
human price: 2500
quote decimals: 9
scaled price: 2500 * 10^9 = 2500000000000Apply market precision rules before submitting.
Quantity Scaling
Quantities are submitted as integer strings. Scale quantities using the base asset decimals.
Example:
human quantity: 0.1
base decimals: 9
scaled quantity: 0.1 * 10^9 = 100000000max_precision
max_precision limits how many significant digits are accepted for a value. Values may differ by market, asset, and network.
If your order fails with an invalid amount or precision error, check:
- base and quote decimals
- market
max_precision - minimum order value
- dust limits
SDK Handling
Official SDK methods accept human-readable prices and quantities in common flows and handle scaling internally.
For custom integrations or direct REST calls, follow the same scaling and truncation rules explicitly.
Related pages: