Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CoreUnified QuotesOverview

Unified quotes

@symmio/trading-core folds every source of quote-ish data — on-chain positions and pending quotes, pending instant-opens, pending instant-closes, and solver notifications — into one stable, de-duplicated, lifecycle-tagged shape: the UnifiedQuote. It is the primary abstraction consumers build quote and position UIs against.

The rest of the SDK returns raw records from each source. This module is the reconciliation engine that merges them. reconcileQuotes performs a pure, deterministic merge of one snapshot of every source into a de-duplicated row list; applyNotificationToQuotes advances a row’s lifecycle as solver notifications arrive; resolveQuoteAccounts works out which on-chain accounts (a sub-account plus its Virtual Accounts) hold the picture; and the shouldAccelerate* predicates tell a poll scheduler when to tighten its interval.

Every function here is a pure transform — no config, no clock, no network — except resolveQuoteAccounts, which reads Virtual Account addresses on-chain. The merge is stable across ticks: a temp (off-chain) row keeps its identity as it anchors on-chain, so React lists never flicker. The React layer’s useManagedQuotes composes all of it into a live quote list; framework-agnostic consumers call these functions directly.

Each type and function has its own page with the full signature, fields or parameters, return shape, and examples.

Types

Reconciliation

Polling

Grouped positions

Several quotes in the same market and on the same side fold into one row: a QuoteGroup. The aggregate* functions roll a group’s children into one figure each. aggregateGroupMetrics is price-independent and runs inside groupQuotes; the other two take the inputs they need explicitly, because a mark price and a subgraph read are not the reconciler’s to fetch.

Grouping is a MARKET_DIRECTION-only feature — the one isolation where a market + side cohort is a real on-chain unit. groupQuotes throws for any other isolation type; check first with supportsQuoteGrouping, or pass an explicit { keyOf } to fold on a dimension of your own.

Closing a group

Adapters

  • Notifications stream — the source applyNotificationToQuotes and classifyQuoteNotificationAction fold in.
  • getSubAccountQuotes — the convenience read that runs resolveQuoteAccounts + the source reads + reconcileQuotes in one call.
  • Solvers — PendingInstantOpen / PendingInstantClose from getInstantOpens / getInstantCloses feed the reconciler.
  • React useManagedQuotes — the hook composed on top of everything here.
  • Margin & risk — calculateMarginRisk turns a group’s uPnL plus its account balance into equity and distance to liquidation.
Last updated on