The Proof exchange engine emits a stream of strongly-typed events each time state changes — orders fill, positions open and close, funding is applied, and accounts are liquidated. These events are delivered via the WebSocket feed atDocumentation 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.
wss://api.dev.proof.trade/ws and surfaced in the SDK through client.subscribeBlocks. Every variant belongs to the ExchangeEvent discriminated union and is identified by a string type field.
ExchangeEvent union type
event.type to narrow to a specific variant:
OrderPlacedEvent
Emitted when a limit order is successfully placed on the order book.Event discriminator.
Engine-assigned order ID (stringified integer, monotonically increasing within a market).
Market identifier as a decimal string.
Hex-encoded 20-byte owner address.
Order side:
"Buy" or "Sell".Limit price in cents with 2 decimal places (e.g.,
"6675234" = $66,752.34).Order quantity in integer contracts.
Client-assigned order ID, or
"0" when absent.OrderCancelledEvent
Emitted when a resting order is cancelled, whether by the user, by a liquidation, or due to a TTL expiry.Event discriminator.
Engine-assigned order ID.
Market identifier as a decimal string.
Hex-encoded 20-byte owner address.
Human-readable cancellation reason (e.g.,
"user_requested", "liquidation", "ttl_expired").Quantity originally accepted onto the book in integer contracts.
Quantity still resting at the moment of cancellation.
Cumulative maker quantity filled before cancellation.
Client-assigned order ID, or
"0" when absent.TradeExecutedEvent
Emitted when a fill is matched between a maker (resting) order and a taker (crossing) order. OneTradeExecutedEvent is emitted per individual fill.
Event discriminator.
Unique fill identifier for this specific match.
Market identifier as a decimal string.
Execution price in cents (2 decimal places).
Fill quantity in integer contracts.
Engine-assigned order ID of the resting (maker) order.
Maker’s client-assigned order ID, or
"0" when absent.Hex-encoded 20-byte address of the maker.
Side of the maker’s order:
"Buy" or "Sell".Hex-encoded 20-byte address of the taker.
Taker’s client-assigned order ID, or
"0" when absent.Taker fee in microUSDC. Current engine emits non-negative charges.
Maker fee in microUSDC. Current engine emits non-negative charges (rebates appear as credits via
FeesCollectedEvent).FeesCollectedEvent
Emitted alongside eachTradeExecutedEvent to provide a per-fill fee summary. Both events arrive in the same block.
Event discriminator.
Market identifier as a decimal string.
Hex-encoded 20-byte address of the taker.
Taker fee in microUSDC (signed).
Hex-encoded 20-byte address of the maker.
Maker fee in microUSDC (signed).
DepositedEvent
Emitted when USDC is credited to an account (viaConfirmDeposit or the legacy Deposit action).
Event discriminator.
Hex-encoded 20-byte owner address.
Deposited amount in microUSDC (6 decimal places).
Account balance after the deposit in microUSDC.
WithdrawnEvent
Emitted when USDC is debited from an account.Event discriminator.
Hex-encoded 20-byte owner address.
Withdrawn amount in microUSDC (6 decimal places).
Account balance after the withdrawal in microUSDC.
PositionUpdatedEvent
Emitted when a position is opened or when its size or entry price changes due to a fill. Reflects the position state after the mutation.Event discriminator.
Hex-encoded 20-byte owner address.
Market identifier as a decimal string.
Position side:
"Buy" = long, "Sell" = short.Weighted-average entry price in cents (2 decimal places) after the fill.
Absolute position size in integer contracts after the fill.
PositionClosedEvent
Emitted when a position is fully closed (size reaches zero).Event discriminator.
Hex-encoded 20-byte owner address.
Market identifier as a decimal string.
Realized PnL in microUSDC (signed). Positive = profit, negative = loss.
PriceUpdatedEvent
Emitted when the oracle price is updated for a market.Event discriminator.
Market identifier as a decimal string.
New oracle price in cents (2 decimal places).
MarketCreatedEvent
Emitted when a new perpetual market is registered on the exchange.Event discriminator.
Market identifier as a decimal string.
Initial margin requirement in basis points.
Maintenance margin requirement in basis points.
Taker fee rate in basis points.
Maker fee rate in basis points.
Funding payment interval in milliseconds.
"0" = funding disabled.Maximum absolute funding rate per interval in basis points.
AccountLiquidatedEvent
Emitted when an account is liquidated because its maintenance margin falls below the required threshold.Event discriminator.
Hex-encoded 20-byte address of the liquidated account.
Market identifier as a decimal string.
Side of the liquidated position:
"Buy" or "Sell".Liquidated position size in integer contracts.
Mark price at the time of liquidation in cents (2 decimal places).
Realized PnL from the liquidation in microUSDC (signed).
FundingAppliedEvent
Emitted once per funding interval when periodic funding is settled across a market. Provides the market-wide funding rate and updated cumulative index.Event discriminator.
Market identifier as a decimal string.
Funding rate for this interval in basis points (signed). Positive = longs pay shorts; negative = shorts pay longs.
Cumulative funding index after this application (signed). Used to compute per-position accrued funding.
Block timestamp in milliseconds at which funding was applied.
FundingSettledEvent
Emitted once per open position when funding is settled. Follows the market-levelFundingAppliedEvent in the same block.
Event discriminator.
Hex-encoded 20-byte owner address.
Market identifier as a decimal string.
Funding payment in microUSDC (signed). Positive = received (credit to account), negative = paid (debit from account).
AgentApprovedEvent
Emitted when an owner approves a delegate agent wallet to trade on their behalf. The agent can place and cancel orders but cannot withdraw or move funds.Event discriminator.
Hex-encoded 20-byte address of the account granting delegation.
Hex-encoded 20-byte derived address of the agent wallet.
Hex-encoded 32-byte Ed25519 public key of the agent.
AgentRevokedEvent
Emitted when an owner revokes a previously approved agent wallet.Event discriminator.
Hex-encoded 20-byte address of the account revoking the delegation.
Hex-encoded 20-byte derived address of the revoked agent wallet.
Hex-encoded 32-byte Ed25519 public key of the revoked agent.
MarketOrderProcessedEvent
Emitted exactly once at the end of every market-order transaction that passes envelope validation, regardless of how many fills occurred. This is the authoritative fill-status signal for market orders.filledQuantity to determine the outcome of your market order:
| Condition | Meaning |
|---|---|
filledQuantity == requestedQuantity | Fully filled |
0 < filledQuantity < requestedQuantity | Partial fill; IOC remainder was dropped |
filledQuantity == "0" | No fills — no counterparty available, or all were rejected by self-match prevention |
TradeExecutedEvent emissions and could not distinguish “no counterparty” from “events arrived in a different stream view.”
Event discriminator.
Market identifier as a decimal string.
Hex-encoded 20-byte address of the market order submitter.
Side of the original market order:
"Buy" or "Sell".Quantity originally requested in integer contracts.
Quantity actually filled before the IOC drop in integer contracts.
Client-assigned order ID of the IOC, market-order, or close-position request. Absent when no
clientOrderId was provided.OrderbookLevelUpdatedEvent
Emitted after every mutation to a price level in the order book. Carries the absolute post-mutation state (not a delta), so listeners can maintain a local book snapshot by overwriting the level on every event.Event discriminator.
Market identifier as a decimal string.
Book side:
"Buy" (bids) or "Sell" (asks).Price level in microUSDC.
Total resting quantity at this price level after the mutation in integer contracts. A value of
"0" means the level has been cleared.Number of resting orders at this price level after the mutation.