getQuoteHistory
Terminal (close / liquidation) events for a set of accounts’ quotes. Each row is a single immutable QuoteEvent with its per-event metadata snapshot overlaid onto the (otherwise mutable) quote it belongs to — so a quote closed across several partial closes produces several distinct history rows. Each row also carries the quote’s own indexed fields — fees, CVA / LF, leverage, open timestamps, the open transaction — so a history table needs no second read.
import { getQuoteHistory } from "@symmio/trading-core";
const { rows } = await getQuoteHistory(config, {
subAccounts: [subAccount],
first: 100,
});Every account, deployment, and market filter is optional and applied only when passed — see Filters and paging. Omit subAccounts to read every account’s history, for example a deployment-wide feed scoped by source and marketIds.
Parameters
subAccountsreadonly Address[]optionalThe accounts whose history to read — a SubAccount and/or its Virtual Accounts. The query filters on the quote’s
subAccount (or partyA, see isolationType), so pass every account that may own the relevant quotes. Omit to
read every account’s history; an empty array reads nothing.
isolationTypeSubAccountIsolationTypeoptionalPicks the account filter field. CUSTOM (cross-margin) filters on the quote’s partyA, because cross-margin quotes
carry no subAccount on the subgraph; MARKET / MARKET_DIRECTION (and the default) filter on the quote’s
subAccount. Every account in one call must share it.
sourceAddressoptionalThe deployment’s diamond address (quote_.source). Omit to read every deployment the subgraph indexes.
marketIdsreadonly number[]optionalMarket ids to read (quote_.symbolId_in). Omit for every market; an empty array reads nothing.
closeTypeQuoteCloseTypedefault AllClose-type filter: All, Closed (FILL_CLOSE), ForceClosed, EmergencyClosed, AdlClosed, or Liquidated.
firstnumberdefault 50Page size.
skipnumberdefault 0Page offset.
startTimenumberdefault 0Lower bound on the event timestamp (unix seconds).
endTimenumberdefault 2_000_000_000Upper bound on the event timestamp (unix seconds).
orderDirection"asc" | "desc"default descSort direction on the event timestamp.
chainIdnumberoptionalOptional chain override.
Returns
GetQuoteHistoryReturnTyperowsQuoteHistoryRow[]History rows in event-timestamp order. Each is a terminal QuoteEvent (its closeEventType is one of the
QuoteCloseEventType values) with the event’s immutable metadata snapshot overlaid onto the quote’s fields, so
partial closes read as separate rows with the amounts they closed. See Unified quotes for the
reconciled quote model these rows decorate.
Row fields
All amounts and prices are raw bigint in 18-decimal fixed point, the same scale as the on-chain Quote read. Enum fields are decoded.
The event and its snapshot
These fields describe the close itself. Where the event’s metadata snapshot carries a value (amount, closePrice, openedPrice), it wins over the quote’s mutable value.
QuoteHistoryRoweventIdstringId of the underlying immutable QuoteEvent — use it as the row key.
closeEventTypeQuoteCloseEventTypeThe close or liquidation event that produced the row (FILL_CLOSE, LIQUIDATE_PARTY_A, …).
closedAtnumberEvent block timestamp, unix seconds.
quoteStatusQuoteStatusLifecycle status, forced to CLOSED / LIQUIDATED from the event type.
openedPricebigintOpen price, snapshot-overlaid when the event carried one.
avgClosedPricebigintAverage close price, overlaid with this event’s close price — the price to show for this close.
closedAmountbigintAmount closed by this event (snapshot amount).
quantityToClosebigintQuantity of the close request this event settled.
liquidateAmountbigintLiquidated amount — set only on liquidation rows.
liquidatePricebigintLiquidation price — set only on liquidation rows.
solverFee / staticSolverFee / totalSolverFeebigint | nullThe solver fees this event charged — see Solver fees.
blockNumberbigint | undefinedBlock number of the event, when available.
transactionHex | undefinedTransaction hash of the event, when available.
rawMetadatastring | nullThe event’s raw metadata JSON.
sourceAddressDiamond address the event was indexed from (the subgraph’s source).
The quote, as indexed
These come from the quote entity, not the event snapshot, so every row of the same quote carries the same values. A null means the subgraph has not indexed the field for this quote — never read it as zero.
QuoteHistoryRowquoteIdbigintProtocol quote id.
marketIdnumberMarket id (symbolId).
symbolstring | nullMarket ticker resolved by the subgraph, when known.
positionTypePositionTypeLong or short.
orderTypeOrderTypeLimit or market order (open side).
quantitybigintTotal quote quantity.
requestedOpenPricebigintPrice partyA originally requested to open at.
initialOpenedPricebigint | nullThe fill price before any SETTLE_UPNL moved the open price.
marketPricebigint | nullMarket price when the quote was sent.
closedPricebigint | nullThe quote’s own closedPrice, as indexed — not snapshot-overlaid. For this event’s close price use
avgClosedPrice.
tradingFeebigintPlatform (trading) fee rate the quote was sent with, as an 18-decimal fraction.
closeFeebigintPlatform close fee rate the quote was sent with, as an 18-decimal fraction.
leveragebigint | nullQuote leverage as indexed (18-decimal).
cvabigint | nullLive locked CVA — shrinks on a partial close.
lfbigint | nullLive locked LF — shrinks on a partial close.
initialCvabigintCVA the quote was sent with.
initialLfbigintLF the quote was sent with.
initialPartyAmmbigint | nullPartyA maintenance margin the quote was sent with.
timestampSendQuotenumber | nullWhen the quote was sent, unix seconds.
timestampOpenPositionnumber | nullWhen the position opened, unix seconds.
partyAAddressThe SubAccount or Virtual Account that owns the quote.
partyBAddress | nullThe solver, or null when absent.
subAccountAddress | nullThe account-layer SubAccount, or null when absent (cross-margin quotes carry none).
subAccountOwnerAddress | nullOwner of the quote’s SubAccount, or null when the quote has none.
sendQuoteTransactionHex | nullTransaction of the quote’s SEND_QUOTE event — its open transaction.
openPositionMetadatareadonly (string | null)[]Raw, undecoded metadata of the quote’s OPEN_POSITION events — see Open-position
metadata.
getPoolTradeHistory returns the same QuoteHistoryRow, so pool rows carry every field above too.
Solver fees
Each row carries the solver fees the event charged, decoded from the metadata snapshot’s solverFees list. All three are 18-decimal wei of collateral.
solverFeebigint | nullThe rate-based fee (SOLVER_FEE on the wire) — notional × rate, so it scales with the size this event settled.
null when the event carried no such entry.
staticSolverFeebigint | nullThe flat fee (STATIC_SOLVER_FEE on the wire) — a fixed per-event charge, independent of the settled size. null
when the event carried no such entry.
totalSolverFeebigint | nullSum of every entry in the list, including tags a future contracts release may add that have no named field here,
so the total never under-reports. null when the event recorded no solverFees at all.
Availability. Only FILL_CLOSE events record solver fees. Liquidation and ADL rows read null on all three fields, as do deployments indexed before the fee was recorded (Base analytics today). Treat null as “not recorded” and render it as such — a 0 would claim the solver charged nothing.
The untruncated list stays on rawMetadata, so a tag the SDK does not name individually is still reachable:
const { solverFees } = JSON.parse(row.rawMetadata ?? "{}");
// [["SOLVER_FEE", "659102399999999"], ["STATIC_SOLVER_FEE", "100000000000000000"]]Open-position metadata
openPositionMetadata holds the raw metadata string of each OPEN_POSITION event on the quote, up to 1000 (the subgraph’s page ceiling). The SDK does not decode it and does not judge whether the list is complete: a quote with exactly 1000 entries may have more. Parse what you need — for example the solver fees paid at open:
const opens = row.openPositionMetadata.map((raw) => (raw ? JSON.parse(raw) : null));Query options
import { getQuoteHistoryQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getQuoteHistoryQueryOptions(config, { subAccounts: [subAccount] }));The query is disabled while subAccounts or marketIds is an empty array.
Related
getPoolTradeHistory— the same rows for every trader on one pool’s market.getQuoteEventsByType— any other event type of one quote,OPEN_POSITIONincluded.getSubgraphQuotes— the indexed quote entity itself, closed or not.- React
useQuoteHistory— the hook over this action.