Skip to main content
DerivaDEX user-data events report order outcomes and account changes after sequencing, with per-feed globalOrdinal cursors for replay and reconciliation.

Ordering and replay

These feeds use two ordering layers: a transport order for messages on one websocket connection and a business-event order for updates inside one event family.
IdentifierScopeMeaningClient use
sequenceGlobal server notification streamMonotonically increasing notification number across all feeds and all connectionsUseful for diagnosing cross-connection timing. One connection can observe gaps.
Top-level ordinalOne websocket connectionMonotonically increasing message order across all subscribed feeds on that connectionApply live websocket messages in this order, not by local arrival time.
globalOrdinalOne update familyStable, monotonically increasing identifier for one ORDER_UPDATE, STRATEGY_UPDATE, or TRADER_UPDATE recordUse for REST pagination and reconnect repair inside the same update family. Do not compare across different families.
epochIdExchange epochEpoch in which the underlying state transition was recordedUseful for history inspection and support workflows, not as the primary replay cursor.
txOrdinalOne epoch, REST history onlyTransaction ordinal inside the epochUse with epochId and record-local ordinal when inspecting transaction-local ordering in history responses.
Record-local ordinalOne transaction, REST history onlyOrdinal of this row inside the underlying transactionDistinguishes multiple rows produced by the same transaction.
orderMatchOrdinalOne order-match outcomeShared identifier for all ORDER_UPDATE rows produced by the same match outcomeGroup multi-row trade, liquidation, and match-driven cancellation outcomes.
subscriptionKeyOne subscriptionNormalized key for the subscribed filter setUseful for logging and confirming which filtered stream produced a message.
createdAtOne rowTime the event row was created in storageUseful for display and diagnostics. Do not use as the authoritative replay key.
Message behaviorMeaning
PARTIAL on ORDER_UPDATE, STRATEGY_UPDATE, and TRADER_UPDATEAlways empty. Bootstrap current state from REST before applying live updates.
UPDATECarries one or more business updates in contents.data.
Decimal amounts and pricesEncoded as strings to preserve precision.

Shared payload rules

The three user-data feeds share a few parsing rules even though their payloads differ.
ConventionMeaning
Sparse fieldsConditional fields appear only when that event type needs them. Null or absent fields mean “not applicable,” not “zero.”
REST history and websocket updatesThe websocket payload exposes the live business event. REST history returns the same event families with pagination by globalOrdinal.
Rejection rowsRejections are business events, not transport errors. A healthy connection can deliver them.
Empty bootstrapBecause the initial PARTIAL is empty, a reconnect-safe client needs both REST history and websocket updates.
What a strategy representsA strategy is a cross-margined position container inside one account.
What TRADER_UPDATE coversTRADER_UPDATE covers trader-level DDX balance and profile state, not per-strategy collateral.

ORDER_UPDATE

ORDER_UPDATE reports order posting, fills, liquidations, cancellations, and order-level rejections. When a match produces more than one row, the rows share orderMatchOrdinal.

ORDER_UPDATE fields

FieldPresent whenMeaning
globalOrdinalAlwaysStable event identifier for this order-update family.
epochIdAlwaysEpoch that contains the underlying outcome.
reasonAlwaysOrder update type. See codes below.
symbolAlwaysMarket symbol such as ETHP or BTCP.
makerOrderIntentAlwaysCanonical order identity carried with the row. Includes orderHash, trader address, strategy hash, side, order type, nonce (the client-supplied unique request identifier), and original order attributes.
createdAtAlwaysEvent creation timestamp.
amountPost, trade, liquidation, cancellation, some rejectionsBase-asset quantity affected by the row.
quoteAssetAmountTrade, liquidation, cancellation, some rejectionsQuote-asset amount associated with the affected quantity.
priceTrade, liquidation, many rejection examplesExecution or reference price carried with the row.
orderMatchOrdinalTrade, liquidation, match-driven cancellationShared identifier for all rows from the same match outcome.
Record-local ordinalTrade, liquidation, match-driven cancellation, REST historyPosition of this row inside the matched outcome or transaction-local batch.
takerOrderIntentTrade, match-driven cancellationOpposing order for a trade path or a cancellation generated as part of a match outcome.
lastExecutedAmount, lastExecutedPrice, lastQuoteAssetTransactedAmountRejection after earlier fills in the same lifecycleMost recent executed slice before the rejection row.
cumulativeFilledAmount, cumulativeQuoteAssetTransactedAmountTrade, liquidation, some late-stage rejectionsRunning totals for the affected order lifecycle at this point.
makerFeeCollateral, makerFeeDDX, takerFeeCollateral, takerFeeDDXTrade rows that charge feesFee charged to the maker or taker in USDC or DDX.
makerRealizedPnl, takerRealizedPnlTrade and liquidation rowsRealized PnL for the maker or taker side, excluding fees.
liquidatedTraderAddress, liquidatedStrategyIdHashLiquidation rowsStrategy that was liquidated.
orderRejectionreason = 4Order rejection code.
cancelRejectionreason = 5Cancel or modify rejection code.

ORDER_UPDATE reasons

CodeNameMeaning
0PostThe order entered the book. No fill has occurred yet.
1TradeA fill occurred. Use orderMatchOrdinal to group all rows from the same match outcome.
2LiquidationA liquidation-driven fill occurred. Expect related strategy-side effects on STRATEGY_UPDATE.
3CancellationRemaining size was removed. If takerOrderIntent is present, the cancellation was produced by a match outcome rather than by a standalone user cancel.
4OrderRejectionAn order request or later lifecycle step was rejected in the order domain. The row can appear after earlier fills, so treat it as part of the lifecycle, not as proof that nothing happened before it.
5CancelRejectionA cancel or modify request was rejected. The existing order state may still be live.

Order rejection codes

CodeNameMeaning
0SelfMatchMatching against resting liquidity from the same strategy was prevented.
1SolvencyGuardThe order could not proceed without violating solvency constraints.
2MaxTakerPriceDeviationMatching would have exceeded the mark-price deviation guard.
3NoLiquidityNo usable resting liquidity remained.
4InvalidStrategyThe referenced strategy was invalid or missing.
5PostOnlyViolationA post-only order would have crossed immediately.

Cancel rejection codes

CodeNameMeaning
0InvalidOrderThe cancel or modify target could not be found.

ORDER_UPDATE interpretation notes

SituationInterpretation
One Trade row followed by one Cancellation row with the same orderMatchOrdinalThe match partially filled one side and canceled the residual in the same outcome group.
OrderRejection row after earlier Trade rowsA later step failed after prior fills had already occurred. Preserve the earlier fills and apply the rejection to the remaining order state.
Fully rejected row with placeholder maker fieldsSome makerOrderIntent fields can be empty strings, with placeholder enum values, because no full maker intent was created. Parsers must not treat those fields as complete order metadata.
Liquidation rowTreat as both an order outcome and an event that also changes account state. The definitive collateral and position update appears on STRATEGY_UPDATE.

STRATEGY_UPDATE

STRATEGY_UPDATE reports collateral movement and strategy-level position effects in one strategy.

STRATEGY_UPDATE fields

FieldPresent whenMeaning
globalOrdinalAlwaysStable event identifier for the strategy-update family.
epochIdAlwaysEpoch that contains the underlying update.
reasonAlwaysStrategy update type. See codes below.
traderAddressAlwaysAccount that owns the strategy.
strategyIdHashAlwaysStrategy identifier.
collateralAddressAlwaysCollateral token address for the update.
collateralSymbolAlwaysCollateral symbol. Current public examples use USDC.
createdAtAlwaysEvent creation timestamp.
amountMost rowsSigned amount added to or removed from the strategy.
newAvailCollateralDeposit, withdraw intent, funding, trade, fee, liquidation, ADL, some settlement flowsAvailable collateral after the update, when affected.
newLockedCollateralWithdraw, withdraw intentLocked collateral after the update, when affected.
positionsPnL settlement, trade, liquidation, ADLPosition state carried with the event. Use it to update strategy positions after the mutation.
blockNumberOn-chain deposit, withdraw, and some rejection examplesEthereum block number when the update was processed, if applicable.
withdrawRejectionreason = 9Withdrawal rejection code.

STRATEGY_UPDATE reasons

CodeNameMeaning
0DepositCollateral increased through an on-chain deposit.
1WithdrawLocked collateral was reduced by a completed withdrawal claim.
2WithdrawIntentCollateral moved from available to locked in preparation for withdrawal.
3FundingPaymentFunding moved value into or out of available collateral.
4PnlSettlementPeriodic PnL realization updated collateral and can refresh position basis fields.
5TradeA fill changed strategy collateral and position state. Expect the paired order-domain outcome on ORDER_UPDATE.
6FeeTrading or stressed-path fees changed available collateral.
7LiquidationLiquidation resolved the strategy. Positions close or shrink, and available collateral can be driven to zero.
8ADLAuto-deleveraging adjusted positions and collateral during stressed resolution.
9WithdrawRejectionA withdrawal attempt was rejected. No collateral move should be inferred from the rejection row itself.

Withdrawal rejection codes

CodeNameMeaning
0InvalidStrategyThe referenced strategy was invalid or missing.
1InvalidInsuranceFundContributionThe insurance-fund contribution reference was invalid or missing.
2MaxWithdrawalAmountThe requested amount exceeded the allowed maximum.
3InsufficientInsuranceFundContributionThe withdrawal exceeded the contributed insurance-fund amount.
4InsufficientRemainingInsuranceFundThe withdrawal would leave the insurance fund below the required level.

STRATEGY_UPDATE interpretation notes

SituationInterpretation
WithdrawIntent with both newAvailCollateral and newLockedCollateralFunds moved between collateral buckets inside the strategy.
Withdraw with only newLockedCollateralA claim reduced locked collateral; available collateral does not increase at this stage.
Trade plus Fee rows in the same sequence windowA fill changed the strategy and then charged fees as a separate strategy event. Apply both.
Liquidation or ADL with positionsPosition state after stressed resolution is carried on the strategy event. Reconcile positions from this feed, not from ORDER_UPDATE alone.

TRADER_UPDATE

TRADER_UPDATE reports trader-level DDX balance changes and profile state.

TRADER_UPDATE fields

FieldPresent whenMeaning
globalOrdinalAlwaysStable event identifier for the trader-update family.
epochIdAlwaysEpoch that contains the underlying update.
reasonAlwaysTrader update type. See codes below.
traderAddressAlwaysTrader account address.
createdAtAlwaysEvent creation timestamp.
amountBalance-changing rowsSigned DDX amount added to or removed from the trader.
newAvailDDXBalanceDeposit, withdraw intent, rewards, fees, distributionsAvailable DDX balance after the update, when affected.
newLockedDDXBalanceWithdraw, withdraw intentLocked DDX balance after the update, when affected.
payFeesInDDXProfile updatesWhether trading fees should be charged in DDX when possible.
blockNumberOn-chain deposit examplesEthereum block number when applicable.
withdrawDDXRejectionreason = 9DDX withdrawal rejection code.

TRADER_UPDATE reasons

CodeNameMeaning
0DepositDDXDDX increased through an on-chain deposit.
1WithdrawDDXLocked DDX was reduced by a completed withdrawal claim.
2WithdrawDDXIntentDDX moved from available to locked in preparation for withdrawal.
3TradeMiningRewardTrade-mining rewards increased available DDX.
4ProfileUpdateTrader-level preferences changed, including the fee-payment preference.
5FeeDistributionFee distribution credited DDX to the trader.
6AdmissionTrader access was granted.
7DenialTrader access was denied.
8FeeFees charged in DDX reduced available balance.
9WithdrawDDXRejectionA DDX withdrawal attempt was rejected.

DDX withdrawal rejection codes

CodeNameMeaning
0InvalidTraderThe referenced trader was invalid or missing.
1InsufficientDDXBalanceThe trader did not have enough DDX.

TRADER_UPDATE interpretation notes

SituationInterpretation
ProfileUpdate with payFeesInDDX onlyPreference change without a balance mutation.
WithdrawDDXIntent with both balance fieldsDDX moved between available and locked buckets.
Fee after trading activityA trader elected to pay fees in DDX, so the DDX balance changed separately from strategy collateral.

How to correlate events across feeds

These joins are the practical keys for reconciliation logic.
If you observeAlso expectJoin keys
ORDER_UPDATE with reason = TradeOne or more STRATEGY_UPDATE rows for trade collateral and fee effectsTrader address, strategy hash, symbol, nearby createdAt, and the surrounding websocket-message ordinal window
ORDER_UPDATE with reason = LiquidationSTRATEGY_UPDATE liquidation and possibly fee rowsLiquidated trader address, liquidated strategy hash, symbol, and nearby message ordering
Strategy-side withdrawal intent or claimSTRATEGY_UPDATE onlyTrader address and strategy hash
DDX withdrawal intent, claim, reward, or feeTRADER_UPDATE onlyTrader address
Reconnect repair for one update familyREST history for the same familyResume from the last applied globalOrdinal of that family
Apply websocket messages in top-level ordinal order, use globalOrdinal for family-local replay, and use orderMatchOrdinal only inside ORDER_UPDATE batches that belong to one match outcome.
Last modified on May 1, 2026