The Proof Trading SDK exposes a set of strongly-typed query response interfaces that mirror the engine’s MessagePack wire format. Every type documented here is defined inDocumentation 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.
src/types.ts and is returned directly by client query methods such as queryOrderbook, queryAccount, and queryMarketConfig. Numeric values carried as bigint preserve full precision for on-chain integers (prices in cents, balances in microUSDC, contract quantities); fields marked number are safely bounded integers such as market IDs and basis-point rates.
Orderbook
Aggregated order book snapshot for a market. Returned byclient.queryOrderbook(marketId).
Bid (buy) levels, sorted best (highest price) first.
Ask (sell) levels, sorted best (lowest price) first.
OrderbookLevel
A single aggregated price level in the order book.Price in cents with 2 decimal places (e.g.,
6675234n = $66,752.34).Total resting quantity at this level in integer contracts (lots).
Number of individual resting orders at this level.
OpenOrder
A single resting order on the book. Returned byclient.queryOpenOrders(address). Wire shape is a 6-tuple [id, market, owner, side, price, quantity].
Engine-assigned order ID. Monotonically increasing within a market.
Market identifier.
20-byte owner address derived from the Ed25519 public key.
Order side:
"Buy" for long, "Sell" for short.Limit price in cents (2 decimal places).
Resting quantity in integer contracts.
AccountInfo
Full account snapshot including balance, open positions, and margin state. Returned byclient.queryAccount(address). Wire shape is a positional MessagePack array; index numbers are stable for backward compatibility.
[0] Available USDC balance in microUSDC (6 decimal places). Example: 100_000_000_000n = $100,000.[1] All open positions for this account. See PositionInfo below.[2] Total equity in microUSDC (balance + unrealized PnL). Scenario-aware: returns the worst-case equity across all active impact-market resolution outcomes.[3] Total maintenance margin requirement in microUSDC. Scenario-aware: returns the maximum MM across all resolution outcomes.[4] Total initial margin requirement in microUSDC.[5] Current margin ratio in basis points (equity / total notional × 10,000).[6] The resolution scenario that maximises totalMm — one entry per active impact market, ascending by impactMarketId. Empty for perp-only accounts. Absent on responses from gateways older than 2026-04-24.[7] Cumulative trading fees paid (positive) or rebates received (negative) in microUSDC. Updated atomically at fill time. New accounts read 0n. Absent on gateways predating 2026-05-03.[8] Rolling 30-day taker volume in microUSDC at the account’s last volume update. Used by the engine to select the applicable fee tier before the next fill. Absent on older gateways.PositionInfo
Information about a single open position. Fields[0]–[5] are raw engine state; fields [6]–[12] are response-only enrichments computed at query time. Indices are stable with the msgpack wire tuple.
[0] 20-byte owner address.[1] Market identifier.[2] Position side: "Buy" = long, "Sell" = short.[3] Weighted-average entry price in cents (2 decimal places).[4] Absolute position size in integer contracts.[5] Cumulative funding index at the time the position was last settled.[6] Unrealized P&L at the current mark price (signed), unconditional. Perp and CP positions use the oracle as the current mark; binary positions return 0 — use pnlIfFires/pnlIfDies instead.[7] Maintenance margin contribution of this position when its firing branch is active. Zero under the non-firing branch for CP/binary positions.[8] Initial margin contribution. Same firing-branch semantics as mmNow.[9] Position value if its branch fires (μ = 1): sign(side) × (settle × size − entry × size). Perpetuals always fire; CP fires when the event resolves to its branch; binary fires and settles to BINARY_PRICE_MAX × size.[10] Position value if its branch does NOT fire (μ = 0): sign(side) × (0 − entry × size). For perpetuals this equals upnlNow (perps never die, reported for UI column symmetry).[11] Funding accrued since the position’s last settled funding index, in microUSDC. Positive = credit received, negative = debit paid.[12] Auto-deleveraging queue score: max(0, upnlNow) × leverage_used. Higher values are closer to the front of the ADL queue. Only profitable positions have a non-zero score. UIs should rank positions by adlScore descending to compute a per-market percentile and warn above the 90th percentile.AdlQueueEntry
One row of the auto-deleveraging queue for a market. Returned byGET /v1/adl/queue/{market}, sorted by adlScore descending (front of queue first). Wire shape is a 6-tuple [owner, market, side, size, upnlNow, adlScore].
20-byte owner address.
Market identifier.
Position side:
"Buy" = long, "Sell" = short.Position size in integer contracts.
Unrealized PnL at the current mark price (signed). Always positive in this queue — only profitable positions are eligible for ADL.
max(0, upnlNow) × leverage_bps. Higher = closer to the front of the queue. Tied with PositionInfo.adlScore for the same position.Ticker
One-round-trip market summary for the markets-page card rail and the perp trade ticker bar. Returned byclient.queryTicker(marketId).
Market ID as a decimal string.
Last fill price within the 24-hour window.
"0" or empty if no trades have occurred.Sum of contract quantities filled in the 24-hour window (integer contracts).
Signed 24-hour price change in basis points.
"0" or empty if no trades have occurred.Base64-encoded msgpack blob containing the
FundingInfo struct (mark EWMA, oracle price, funding rate, and interval). Decode with @msgpack/msgpack.Base64-encoded msgpack blob containing an
OrderbookSnapshot at depth 1. Empty string for fresh markets with no resting orders.Always
null today — the engine does not yet track open interest. UIs should render "—" or "coming soon" for this column.MarketConfig
Full configuration for a perpetual, conditional, or binary market. The wire form is a positional MessagePack array; indices mirror the Rust struct field order. Fields after index 7 useserde(default) so older on-chain records decode cleanly.
[0] Market identifier (unique integer).[1] Initial margin requirement in basis points (e.g., 1000 = 10% = 10× max leverage).[2] Maintenance margin requirement in basis points (e.g., 500 = 5%).[3] Taker fee rate in basis points (e.g., 5 = 0.05%).[4] Maker fee rate in basis points (e.g., 2 = 0.02%).[5] Funding payment interval in milliseconds. 0 = funding is disabled.[6] Maximum absolute funding rate per interval in basis points.[7] Market kind discriminator. Defaults to "Perp" for legacy records. Parameterised variants are { ConditionalPerp: [impactId, "Yes" | "No"] } and { PredictionBinary: [impactId, "Yes" | "No"] }.[8] Per-account absolute position cap in integer contracts. 0 = no limit.[9] Default order TTL in milliseconds. 0 = no automatic expiry. When set, resting orders older than this value are swept at the end of each block.[10] When true, firing legs sharing the same underlying are netted into a single position for MM/IM calculations (|Σ signed_size| × settle × weighted_bps). When false, per-leg scenario margin applies.[11] Insurance-fund pool ID. Markets in different pools are insulated from each other’s liquidation cascades. 0 = shared default pool.[12] Maximum oracle age in milliseconds before the engine refuses to use the oracle price for mark calculations. 0 = no staleness check.[13] Volume-based fee tier table. Empty array = flat taker/maker fees apply.[14] Minimum price increment in microUSDC. 0 = no tick gate (any price accepted).[15] Minimum quantity increment in integer contracts. 0 = no lot gate (any quantity accepted).[16] 20-byte primary oracle signer address. When set, oracle updates from this signer take precedence. Pass an all-zero address to clear.[17] Oracle staleness threshold in milliseconds. Only consulted when primaryOracleSigner is set. 0 = gate disabled.[18] Mark-price source mode. "OracleOnly" = legacy oracle-only mode; "Median" = median of oracle and book-mid. Has no effect on impact-family child markets.[19] Thin-book spread cap in basis points for the "Median" mark-price guard. 0 resets to the engine default (100 bps). Ignored unless markSourceMode === "Median".[20] Maximum age in milliseconds for the composite-CEX price source in "Median" mode. 0 resets to the engine default (30 seconds).[21] When true, liquidation closes one position at a time and rechecks maintenance margin before proceeding. When false, all-or-nothing liquidation applies.[22] Published size scale: order and position quantities are in units of 10^-szDecimals of the base asset (display/metadata only — the engine never reads this field). 0 = integer-unit sizing.[23] Human-readable ticker symbol (e.g., "BTC"). Display/metadata only; capped at 24 bytes. Fixed at market creation and immutable thereafter.History Types
HistoryCashFlow
One row of the per-user deposit/withdrawal cash-flow log. Returned byGET /v1/history/deposits/{address} and GET /v1/history/withdrawals/{address}.
One of
"deposit_confirmed", "withdraw_requested", "withdrawal_confirmed", or "withdrawal_failed".20-byte owner address as a hex string.
Amount in microUSDC (always positive). May be empty for
"withdrawal_confirmed" events.Signed balance change for this event:
+amount for deposit_confirmed and withdrawal_failed (credit); -amount for withdraw_requested (debit); "0" for withdrawal_confirmed (no balance change on acknowledgement).Post-event balance in microUSDC. Empty for
"withdrawal_confirmed" since no balance change occurs on that event.Present on withdrawal events (
withdraw_requested, withdrawal_confirmed, withdrawal_failed).Present on
deposit_confirmed and withdrawal_confirmed events.Present on
withdraw_requested events only.Human-readable failure reason. Present on
withdrawal_failed events only.Block height at which the event landed.
Unix timestamp in milliseconds.
HistoryResolution
One row of the per-user position-at-resolution log. Returned byGET /v1/history/resolutions/{address}.
One of
"conditional_settled", "conditional_voided", or "prediction_settled".Impact-market family ID that the resolved position belonged to.
Child market ID (CPY/CPN or EBY/EBN).
20-byte owner address as a hex string.
Position side at resolution:
"Buy" = long, "Sell" = short.Position size at resolution in integer contracts (stringified to preserve
BIGINT precision).Weighted-average entry price of the resolved position.
Settlement price used for PnL calculation.
conditional_settled → mark price; prediction_settled → payoff per share (BINARY_PRICE_MAX for winner, 0 for loser); conditional_voided → empty string (void path returns margin, no cash movement).Signed realized PnL in microUSDC.
"0" for conditional_voided.Block height at which the resolution landed.
Unix timestamp in milliseconds.
HistoryPositionSnapshot
One row of the per-user position-history snapshot log. Each entry is a point-in-time snapshot written after every fill that changes position state (open → grow → reduce → close). Asize of "0" represents a close event. Returned by GET /v1/history/positions/{address} with optional ?market=&from=&to=&limit= filters; results are newest-first.
20-byte owner address as a hex string.
Market ID as a decimal string.
Position side:
"Buy" = long, "Sell" = short.Weighted-average entry price in microUSDC at the time of the snapshot.
Absolute position size in integer contracts.
"0" indicates the position was closed at this block.Block height at which the snapshot landed.
Unix timestamp in milliseconds.
WithdrawalRecord
On-chain withdrawal record returned byqueryWithdrawal. Mirrors exchange-core::types::WithdrawalRecord field-for-field.
Engine-assigned withdrawal ID.
20-byte address that requested the withdrawal.
Withdrawal amount in microUSDC.
Solana destination public key (Ed25519, 32 bytes).
Lifecycle status. Transitions are one-way:
Pending → Completed or Pending → Failed; never reverses.Block height at which the withdrawal request was admitted.
ImpactMarketInfo
On-chain info for an impact-market family (a set of 4–5 related books). Returned by theimpactMarketInfo query.
Impact-market family identifier.
The underlying perpetual market this impact market is derived from.
Child market ID for the Conditional Perp Yes (CPY) leg.
Child market ID for the Conditional Perp No (CPN) leg.
Child market ID for the Event Binary Yes (EBY) leg.
Child market ID for the Event Binary No (EBN) leg.
Human-readable question text for the event (e.g.,
"Will BTC exceed $100k by Q4?").Unix timestamp in milliseconds at which the event’s trading window closes.
Duration in milliseconds after
deadlineMs during which the resolver must submit an outcome.Current lifecycle status of the impact market.
Unix timestamp in milliseconds at which the impact market was created.
Unix timestamp in milliseconds at which the event was resolved.
0 if not yet resolved.