QuoteGroupMetrics
Pure, price-independent aggregations over a grouped position’s child quotes. Every amount is 18-decimal wei bigint.
Metrics that need a live mark price or VA balance — unrealized PnL, market value, liquidation price — are intentionally not here: they need injected inputs and belong to the caller.
Properties
quoteCountnumberrequiredNumber of child quotes in the group.
openCountnumberrequiredChildren classified as active positions.
pendingCountnumberrequiredChildren classified as resting/pending orders.
quantitybigintrequiredΣ of each child’s original quantity (pre-close), wei.
openQuantitybigintrequiredΣ of each child’s open quantity (quantity − closedAmount) — the live aggregated size, wei.
weightedOpenPricebigintoptionalQuantity-weighted average open price: Σ(openQuantity × price) / Σ openQuantity. undefined while the group has no
open size, or while any child still lacks a settled open price — render a loading state in that case.
initialNotionalbigintrequiredΣ frozen at-open notional (quantity × (initialOpenedPrice ?? requestedOpenPrice)), wei. Partial closes do not
shrink it.
lockedValuesLockedValuesrequiredΣ of each margin leg (cva, lf, partyAmm, partyBmm) across children, wei.
leveragebigintoptionalBlended opening leverage as an 18-decimal fixed-point bigint (2.5x → 2_500000000000000000n): Σ(quantity × (requestedOpenPrice ?? openedPrice)) / Σ(cva + lf + partyAmm + partyBmm), each child using its frozen
initialLockedValues. undefined when that margin is 0.