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

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[]optional

The 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.

isolationTypeSubAccountIsolationTypeoptional

Picks 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.

sourceAddressoptional

The deployment’s diamond address (quote_.source). Omit to read every deployment the subgraph indexes.

marketIdsreadonly number[]optional

Market ids to read (quote_.symbolId_in). Omit for every market; an empty array reads nothing.

closeTypeQuoteCloseTypedefault All

Close-type filter: All, Closed (FILL_CLOSE), ForceClosed, EmergencyClosed, AdlClosed, or Liquidated.

firstnumberdefault 50

Page size.

skipnumberdefault 0

Page offset.

startTimenumberdefault 0

Lower bound on the event timestamp (unix seconds).

endTimenumberdefault 2_000_000_000

Upper bound on the event timestamp (unix seconds).

orderDirection"asc" | "desc"default desc

Sort direction on the event timestamp.

chainIdnumberoptional

Optional chain override.

Returns

GetQuoteHistoryReturnType
rowsQuoteHistoryRow[]

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.

QuoteHistoryRow
eventIdstring

Id of the underlying immutable QuoteEvent — use it as the row key.

closeEventTypeQuoteCloseEventType

The close or liquidation event that produced the row (FILL_CLOSE, LIQUIDATE_PARTY_A, …).

closedAtnumber

Event block timestamp, unix seconds.

quoteStatusQuoteStatus

Lifecycle status, forced to CLOSED / LIQUIDATED from the event type.

openedPricebigint

Open price, snapshot-overlaid when the event carried one.

avgClosedPricebigint

Average close price, overlaid with this event’s close price — the price to show for this close.

closedAmountbigint

Amount closed by this event (snapshot amount).

quantityToClosebigint

Quantity of the close request this event settled.

liquidateAmountbigint

Liquidated amount — set only on liquidation rows.

liquidatePricebigint

Liquidation price — set only on liquidation rows.

solverFee / staticSolverFee / totalSolverFeebigint | null

The solver fees this event charged — see Solver fees.

blockNumberbigint | undefined

Block number of the event, when available.

transactionHex | undefined

Transaction hash of the event, when available.

rawMetadatastring | null

The event’s raw metadata JSON.

sourceAddress

Diamond 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.

QuoteHistoryRow
quoteIdbigint

Protocol quote id.

marketIdnumber

Market id (symbolId).

symbolstring | null

Market ticker resolved by the subgraph, when known.

positionTypePositionType

Long or short.

orderTypeOrderType

Limit or market order (open side).

quantitybigint

Total quote quantity.

requestedOpenPricebigint

Price partyA originally requested to open at.

initialOpenedPricebigint | null

The fill price before any SETTLE_UPNL moved the open price.

marketPricebigint | null

Market price when the quote was sent.

closedPricebigint | null

The quote’s own closedPrice, as indexed — not snapshot-overlaid. For this event’s close price use avgClosedPrice.

tradingFeebigint

Platform (trading) fee rate the quote was sent with, as an 18-decimal fraction.

closeFeebigint

Platform close fee rate the quote was sent with, as an 18-decimal fraction.

leveragebigint | null

Quote leverage as indexed (18-decimal).

cvabigint | null

Live locked CVA — shrinks on a partial close.

lfbigint | null

Live locked LF — shrinks on a partial close.

initialCvabigint

CVA the quote was sent with.

initialLfbigint

LF the quote was sent with.

initialPartyAmmbigint | null

PartyA maintenance margin the quote was sent with.

timestampSendQuotenumber | null

When the quote was sent, unix seconds.

timestampOpenPositionnumber | null

When the position opened, unix seconds.

partyAAddress

The SubAccount or Virtual Account that owns the quote.

partyBAddress | null

The solver, or null when absent.

subAccountAddress | null

The account-layer SubAccount, or null when absent (cross-margin quotes carry none).

subAccountOwnerAddress | null

Owner of the quote’s SubAccount, or null when the quote has none.

sendQuoteTransactionHex | null

Transaction 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 | null

The 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 | null

The 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 | null

Sum 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.

Last updated on