UnifiedQuote
A single quote/position row merged from every source — on-chain reads, pending instant-opens, pending instant-closes, and notifications — into one stable, de-duplicated shape. This is the primary abstraction quote and position UIs build against; every other function in this module reads or produces it.
All amount and price fields are 18-decimal-wei bigint, matching the on-chain Quote. Off-chain hedger amounts are normalized to wei before they reach this type. The key is a stable identity for React lists and the removal ledger; it migrates from temp:<tempId> to onchain:<id> when a row anchors, but the row’s identity is preserved. raw carries the untouched source rows for advanced use.
import type { UnifiedQuote } from "@symmio/trading-core";Fields
keystringStable identity for this row (
onchain:<id> or temp:<tempId>). Survives the temp → on-chain anchor transition.originQuoteOriginSource the row was reconciled from.
lifecycleQuoteLifecycleCurrent lifecycle stage.
quoteIdbigintOn-chain quote id, once anchored. Absent while the row is still off-chain.
tempQuoteIdnumberHedger-local temp id, before the on-chain id exists (negative).
partyAAddressSub-account (partyA) that owns the row.
partyBAddressPartyB (hedger/solver) that locked/opened the quote, when known.
vaAddressAddressSolver-assigned Virtual Account address (lowcap), when known.
symbolIdbigintMarket identifier (
symbolId).positionTypePositionTypeLong or short.
orderTypeOrderTypeLimit or market order.
quoteStatusQuoteStatusOn-chain status, when the row is anchored on-chain.
requestedOpenPricebigintPrice partyA requested to open at (wei).
openedPricebigintPrice partyB actually opened at (wei), when known.
initialOpenedPricebigintInitial price partyB opened at before any edits (wei), when known.
avgClosedPricebigintAverage price across executed closes (wei), when known.
requestedClosePricebigintRequested limit price for a pending close (wei), when known.
marketPricebigintMarket price snapshot at last state change (wei), when known.
quantitybigintTotal requested quantity (wei) — fixed for the life of the position; partial closes do not shrink it.
closedAmountbigintQuantity already closed (wei), when known.
openQuantitybigintRemaining open size (wei):
quantity − closedAmount, the live quantity still on the position (the figure a UI shows as “position size”); 0 once fully closed.quantityToClosebigintQuantity targeted by a pending close (wei), when closing.
lockedValuesLockedValuesMargin locked against the row (wei) — CVA, LF, and the two maintenance-margin legs.
initialLockedValuesLockedValuesMargin locked at open time — basis for leverage (wei), when known.
maxFundingRatebigintMaximum funding rate partyA accepts, when known.
accumulatedPaidFundingbigintNet funding paid (positive) or received (negative) over the position’s life (wei), when known.
lastFundingPaymentTimestampbigintBlock timestamp funding was last applied, when known.
deadlinebigintQuote deadline (expiry) timestamp, when known.
tradingFeebigintTrading fee charged on the quote (wei), when known.
closeFeebigintFee charged on close (wei), when known.
affiliateAddressAffiliate address attributed to the quote, when known.
partyBsWhiteListreadonly Address[]PartyB addresses allowed to fill this quote (empty means any), when known.
parentIdbigintParent quote id for a partially-opened child, when known.
dataHexOpaque per-quote data, when known.
createTimestampbigintBlock timestamp the quote was created, when known.
statusModifyTimestampbigintBlock timestamp of the last status change (the reconciler’s sort key), when known.
raw{ onchain?; instantOpen?; instantClose? }Untouched source rows this was reconciled from: the on-chain
Quote (onchain), the PendingInstantOpen (instantOpen), and/or the PendingInstantClose (instantClose) it was merged from.Related
- QuoteOrigin — the
originfield. - QuoteLifecycle — the
lifecyclefield. - toUnifiedQuoteFromOnchain — builds a row from an on-chain
Quote. - reconcileQuotes — produces the merged
UnifiedQuote[].
Last updated on