The Proof Exchange engine and SDK use integer-only arithmetic throughout. There are no floating-point price or balance fields anywhere in the wire format. Every numeric type has a well-defined integer scale, and the engine validates that scale on every submitted transaction. Understanding these conventions is essential before writing any trading logic.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Proof-labs/trading-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Quick reference
| Field | Unit | TypeScript type | Example value | Decoded display |
|---|---|---|---|---|
| Prices | Integer cents (2 dp) | bigint | 6675234n | $66,752.34 |
| Balances / amounts | MicroUSDC (6 dp) | bigint | 100_000_000_000n | $100,000.00 |
| Fees / margin rates | Basis points | number | 500 | 5% |
| Quantities | Integer contracts (lots) | bigint | 1n | 1 contract |
| Addresses | 20-byte binary | Uint8Array | pubkeyToOwner(pubkey) | 20 raw bytes |
Prices — integer cents
Prices are expressed as integer cents with two decimal places. Multiply the dollar price by 100 to get the wire value:queryOrderbook() use the same scale. When displaying a price, divide by 100 (or format with two decimal places):
Balances and amounts — microUSDC
Account balances, deposit amounts, withdrawal amounts, and fees are expressed in microUSDC — millionths of a USDC dollar (6 decimal places). Multiply the dollar amount by 1,000,000:TradeExecutedEvent.takerFee) are also in microUSDC. These come back as strings in event payloads and should be parsed with BigInt().
Fees and margin rates — basis points
Fee rates, initial margin (IM) requirements, and maintenance margin (MM) requirements are all expressed in basis points (bps), where 1 bp = 0.01%:bps / 100. To convert to a multiplier: bps / 10_000.
Quantities — integer contracts (lots)
Order quantities and position sizes are expressed in integer contracts (also called “lots”). There is no fractional-contract support at the wire level. Some markets have aszDecimals metadata field (display-only) indicating that one contract represents 10^-szDecimals of the base asset, but the engine always operates in integer lots:
Addresses — 20-byte Uint8Array
Account addresses are 20-byte binary values, not strings. Theowner field on every action payload accepts a Uint8Array:
queryAccount() and queryOpenOrders() accept either the hex string or omit the argument to use the client’s own address.
Engine validation
The engine validates all of these constraints at transaction time. Submitting a zero price, a fractional quantity expressed as a float-encoded bigint, or a balance that would cause arithmetic overflow all result in non-zero error codes (see Error Codes for details). The most common numeric validation errors are:- Code 6
InvalidPrice— price is zero or negative - Code 7
InvalidQuantity— quantity is zero or negative - Code 5
Overflow— arithmetic overflow during fill or margin calculation - Code 39
TickSizeViolation— price is not a multiple of the market’s configured tick size - Code 40
LotSizeViolation— quantity is not a multiple of the market’s configured lot size
BigInt literals to avoid these errors.