Numeric Values: Strings to Avoid Float Precision Loss
All prices, quantities, and monetary amounts are represented as decimal strings rather than JSON numbers. This avoids the floating-point precision loss that occurs when JSON parsers store large or fractional numbers as IEEE 754 doubles.Raw Integers and Scale Factors
Numeric values in API responses are raw integers. To obtain the human-readable display value, divide by 10 raised to the scale exponent for that field. Use theconfigs endpoint to retrieve priceScale and qtyScale for each contract.
The SOL1 contract’s
priceScale and qtyScale are published by the configs endpoint. Always read scale values from configs rather than hardcoding them — they differ per contract and can change when new contracts are listed.Timestamps
All timestamps are int64 Unix milliseconds — the number of milliseconds elapsed since 1970-01-01T00:00:00Z. Timestamps are represented as JSON integers (not strings).Ethereum Addresses
Addresses follow the standard Ethereum format:0x prefix followed by 40 lowercase hexadecimal characters (42 characters total).
Contract (Asset) IDs
Each perpetual contract has an integer ID stored in thea field of order, cancel, and modify actions. On testnet, the only available contract is SOL1 with ID 1. Call configs to enumerate all contracts and their IDs in any environment.
Client Order IDs (cloid)
A client order ID is an int64 decimal string that you assign when placing an order. It must be a unique positive integer. You can use it later to cancel or query orders without needing the server-assignedoid.
Short Key Convention (Order Payloads)
Order-related actions use single-letter compact keys to reduce payload size. The mapping is:
Example order object using short keys:
Full Key Convention (Margin and Mode Actions)
Margin and account mode actions use full field names rather than single-letter abbreviations:
Example leverage update using full keys: