Skip to main content
The Realtime API streams DerivaDEX market data and account-specific updates over one WebSocket connection.
wss://exchange.derivadex.com/realtime-api
Clients send subscribe and unsubscribe messages on the connection and receive an acknowledgement with the same nonce. Market-data feeds send an initial PARTIAL snapshot before UPDATE messages. User-data feeds start with an empty PARTIAL, so clients fetch current order, strategy, and trader state with REST before applying realtime updates.

Subscription control

ChannelMessagePayloadUse it for
subscribesubscribesubscribePayloadSubscribe to one or more feeds with the parameters required by each feed.
unsubscribeunsubscribeunsubscribePayloadStop one or more feed subscriptions.
subscribe / unsubscribeacknowledgeacknowledgePayloadMatch success or failure responses to client requests by nonce; an empty result means success.

Public market-data feeds

ChannelFeedPayloadSnapshot behaviorUse it for
orderBookL2ORDER_BOOK_L2orderBookL2PayloadFirst message is the current L2 book as PARTIAL; later messages are UPDATEs. An amount of 0 removes the price level.Aggregated order book levels by symbol and price aggregation.
orderBookL3ORDER_BOOK_L3orderBookL3PayloadFirst message is the current L3 book as PARTIAL; later messages are UPDATEs. An amount of 0 removes the order row.Full-depth order book rows by symbol.
markPriceMARK_PRICEmarkPricePayloadFirst message is the latest mark prices and funding rates as PARTIAL; later messages are UPDATEs.Mark price and funding-rate updates by symbol.

Market-data filters

FeedFilter fields
ORDER_BOOK_L2orderBookL2Filters[] with symbol and aggregation. Current aggregation values are 0.1, 1, and 10 for ETHP; 1, 10, and 100 for BTCP.
ORDER_BOOK_L3symbols[]; omitting parameters subscribes to all L3 book orders for all symbols.
MARK_PRICEsymbols[]; omitting parameters subscribes to all mark prices for all symbols.

User-data feeds

ChannelFeedPayloadSnapshot behaviorUse it for
orderUpdateORDER_UPDATEorderUpdatePayloadFirst message is an empty PARTIAL; use REST for the initial order state.Order posts, fills, cancellations, liquidations, ADL, order rejections, and cancel rejections. Messages include maker and taker or liquidated-trader details when applicable.
strategyUpdateSTRATEGY_UPDATEstrategyUpdatePayloadFirst message is an empty PARTIAL; use REST for the initial strategy state.Strategy collateral changes, deposits, withdrawals, withdrawal intents, funding payments, PnL settlement, trades, fees, liquidations, ADL, and withdrawal rejections.
traderUpdateTRADER_UPDATEtraderUpdatePayloadFirst message is an empty PARTIAL; use REST for the initial trader DDX balance.DDX deposits, DDX withdrawals, DDX withdrawal intents, trade mining rewards, fee distribution rewards, profile updates, admission, denial, DDX fees, and DDX withdrawal rejections.

User-data filters

Trader addresses are prefixed with the blockchain discriminant. For Ethereum, the address is prefixed with 0x00.
FeedFilter fields
ORDER_UPDATEorderFilters[] with traderAddress, optional strategyIdHash, optional symbol, and optional reason.
STRATEGY_UPDATEstrategyFilters[] with traderAddress, optional strategyIdHash, and optional reason.
TRADER_UPDATEtraderFilters[] with traderAddress and optional reason.
strategyIdHash is the first 4 bytes of the keccak256 hash of the strategy ID encoded as a 32-byte value. The default main strategy hashes to 0x2576ebd1.

Common payload fields

FieldMeaning
sequenceGlobal monotonically increasing sequence assigned by the server to every notification across all feeds and connections. A single connection may see gaps when other notifications do not match its subscriptions.
ordinalPer-connection sequence number across all feed messages delivered to that connection.
feedFeed name, such as ORDER_BOOK_L2 or STRATEGY_UPDATE.
subscriptionKeyNormalized key for the subscription and ordering scope.
contents.messageTypePARTIAL for the initial snapshot, UPDATE for later changes.
contents.dataFeed-specific records. Decimal quantities are strings to preserve precision.

Update reason codes

FeedCodeReason
ORDER_UPDATE0Post
ORDER_UPDATE1Trade
ORDER_UPDATE2Liquidation
ORDER_UPDATE3Cancellation
ORDER_UPDATE4OrderRejection
ORDER_UPDATE5CancelRejection
STRATEGY_UPDATE0Deposit
STRATEGY_UPDATE1Withdraw
STRATEGY_UPDATE2WithdrawIntent
STRATEGY_UPDATE3FundingPayment
STRATEGY_UPDATE4PnlSettlement
STRATEGY_UPDATE5Trade
STRATEGY_UPDATE6Fee
STRATEGY_UPDATE7Liquidation
STRATEGY_UPDATE8ADL
STRATEGY_UPDATE9WithdrawRejection
TRADER_UPDATE0DepositDDX
TRADER_UPDATE1WithdrawDDX
TRADER_UPDATE2WithdrawDDXIntent
TRADER_UPDATE3TradeMiningReward
TRADER_UPDATE4ProfileUpdate
TRADER_UPDATE5FeeDistribution
TRADER_UPDATE6Admission
TRADER_UPDATE7Denial
TRADER_UPDATE8Fee
TRADER_UPDATE9WithdrawDDXRejection

Rejection codes

FieldCodeReasonMeaning
orderRejection0SelfMatchPart or all of the order was canceled because the same maker owns the best match.
orderRejection1SolvencyGuardPart or all of the order was canceled for failing solvency guards.
orderRejection2MaxTakerPriceDeviationPart or all of the order was canceled because the maker price deviated too far from the mark price.
orderRejection3NoLiquidityAll of the order was canceled because no liquidity remained in the book.
orderRejection4InvalidStrategyAll of the order was canceled because the strategy is invalid or nonexistent.
orderRejection5PostOnlyViolationAll of the order was canceled because it would have matched immediately.
cancelRejection0InvalidOrderThe cancel or modify request failed because the order does not exist.
withdrawRejection0InvalidStrategyThe collateral withdrawal failed because the strategy is invalid or nonexistent.
withdrawRejection1InvalidInsuranceFundContributionThe insurance fund withdrawal failed because the insurance fund contribution is invalid or nonexistent.
withdrawRejection2MaxWithdrawalAmountThe collateral withdrawal failed because the amount exceeds the maximum withdrawal amount.
withdrawRejection3InsufficientInsuranceFundContributionThe insurance fund withdrawal failed because the amount exceeds the contribution amount.
withdrawRejection4InsufficientRemainingInsuranceFundThe insurance fund withdrawal failed because the remaining insurance fund would be dangerously low.
withdrawDDXRejection0InvalidTraderThe DDX withdrawal failed because the trader is invalid or nonexistent.
withdrawDDXRejection1InsufficientDDXBalanceThe DDX withdrawal failed because the trader has insufficient DDX balance.

Integration notes

TopicDetail
Connection URLConnect to wss://exchange.derivadex.com/realtime-api.
BootstrapUse REST for the initial state of orders, strategies, and trader balances before applying user-data updates.
OrderingUse sequence and ordinal fields from message payloads to process updates deterministically.
Subscription identityUser-data subscriptions are filtered by trader address, strategy, symbol, or reason.
RecoveryReconnect with the flow in Realtime Connection Model and re-subscribe to the required feeds.
Last modified on April 27, 2026