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

getPoolTradeHistory

Read a pool’s realized trade history from the analytics subgraph.

import { getPoolTradeHistory } from "@symmio/trading-core"; const { rows } = await getPoolTradeHistory(config, { symbolId: 1, first: 25 });

Pool-wide, not account-scoped: no partyA filter, so these are every trader’s closes on the market. The account-scoped counterpart is getQuoteHistory, which filters by the accounts you pass. Reaching for the wrong one gives an empty table or someone else’s trades.

One row per close event, not per quote

Rows come from the immutable quoteEvents collection with each event’s frozen metadata snapshot overlaid. A quote closed across three partial closes therefore yields three rows, each showing the size and price of that close rather than the quote’s final state.

Use the event metric fields for history totals; full-quote fields remain repeated context, not values to sum across events.

Parameters

chainIdnumberoptional

Target chain id. Defaults to the config’s defaultChainId.

symbolIdnumber | null | undefinedrequired

The pool’s solver market id. Absent means the pool is not tradable, so the action returns an empty result without issuing a request and the query factory stays enabled: false.

closeTypeQuoteCloseTypeoptional

Close-type filter. Defaults to QuoteCloseType.All.

firstnumberoptional

Page size. Defaults to 50.

skipnumberoptional

Page offset. Defaults to 0.

orderDirection"asc" | "desc"optional

Sort direction on the event timestamp. Defaults to "desc".

Returns

{ rows: PoolTradeHistoryRow[], quotes: PoolQuote[] }. Each row retains the QuoteHistoryRow fields returned by getQuoteHistory, including per-event solver fees, except that closeFee is the derived event fee amount below. The raw closing-fee rate remains available on the aligned quotes entry. Pool rows contain these flat bigint | null fields, at 18 decimals:

FieldMeaning
closeQuantity, closePriceEvent close/liquidation size and execution price
tradeValueEvent quantity times price, scaled to 18 decimals
openFeeOpening-fee share attributed to this event’s closed quantity
closeFeeEvent close fee; zero for liquidation
platformFeeopenFee + closeFee, excluding solver, funding and liquidation fees
realizedPnlGross realized PnL before fees, from the shared quote primitive

Missing required inputs yield null. Explicit zero snapshots stay zero. Normal-close quantity falls back from event/closed amount to full quantity; price falls back from average closed price to closed price. Liquidations use liquidation quantity and price; an unknown liquidation price never falls back to an earlier close’s average.

The opening fee uses the event quantity and positive initial fill price, otherwise opened price. Two one-token closes of a two-token position therefore allocate half the opening fee to each row. Independently floored shares may sum to less than the full fee by fewer raw wei than the number of rows. This is an attribution of an already-paid opening fee, not a new charge at close.

Normal, force, emergency and ADL closes include closing fees. All three liquidation event types omit them. The immutable snapshot is applied before deriving metrics; consumers do not need a separate selector call. Rows also retain the quote’s indexed fields — source, fees, CVA / LF, leverage, open timestamps, sendQuoteTransaction, and the raw openPositionMetadata — listed under the quote, as indexed.

Throws

  • UNSUPPORTED_CHAIN / no analytics subgraph — a SymmError (kind: "config").
  • A SymmApiError when the subgraph request itself fails.

Complete event quote snapshots

The result also includes quotes: PoolQuote[], aligned with rows. Each quote includes full fee/owner/lock fields, overlaid with that close event’s immutable amount, entry/close price, liquidation values and status. Pair a quote with its corresponding row’s eventId, closedAt and solver fees; never replace those with the current quote’s cumulative close state.

The quote’s tradingFee and closeFee are fee rates at 18 decimals, not cumulative charged amounts. The row’s openFee and closeFee are derived amounts. Keep these distinct when pairing a row and quote.

import { getPoolTradeHistory, type Config } from "@symmio/trading-core"; export async function historyFees(config: Config) { const { rows } = await getPoolTradeHistory(config, { symbolId: 1, first: 25 }); return rows.map(({ eventId, openFee, closeFee, platformFee }) => ({ eventId, openFee, closeFee, platformFee })); }
Last updated on