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

getQuotesEventsByType

Batched sibling of getQuoteEventsByType: decoded subgraph events for many quotes in one round-trip, optionally filtered to specific event types. This is what a grouped position reaches for — one request covers every child quote instead of one request per leg.

import { FUNDING_HISTORY_EVENT_TYPES, getQuotesEventsByType } from "@symmio/trading-core"; const { rows, hasMore } = await getQuotesEventsByType(config, { quoteIds: [7334n, 7335n], types: FUNDING_HISTORY_EVENT_TYPES, first: 100, });

The merge happens server-side

The subgraph filters on quoteId_in and sorts by timestamp, so rows for every requested id come back already interleaved and time-ordered — newest first unless orderDirection: "asc" is passed. There is no client-side re-sort, and no per-quote fan-out.

Two consequences for paging:

  • first / skip page over the merged stream, not per quote id. A first: 50 page can be 50 rows from a single busy quote.
  • The subgraph caps first at 1000 — do not ask for more than that. Page with skip while hasMore is true instead. Omitting first asks for that ceiling, so an un-paged call returns as much as a single request can serve.

Each row carries its own quoteId, so a caller that wants a per-position breakdown groups by that field client-side.

Event types

types takes any QuoteSubgraphEventType, exactly as on getQuoteEventsByType: the QuoteEventType and QuoteCloseEventType values, or any other type string the subgraph emits ("OPEN_POSITION", "QUOTE_ADJUSTED", …). Each row’s type narrows to the types you pass. Omit types to read every event on the quotes; an empty array reads nothing.

Presets

Two presets ship with the SDK:

  • PRICE_HISTORY_EVENT_TYPES — everything that moves a quote’s open price: SettleUpnl, ChargeFundingRate, ChargeAccumulatedFundingFee.
  • FUNDING_HISTORY_EVENT_TYPES — the funding subset: ChargeFundingRate and ChargeAccumulatedFundingFee. It drops SettleUpnl (an open-price recompute that settles no funding) and keeps exactly the two events that carry fundingPaid / fundingReceived / rate in their metadata.

Which of the two a quote produces depends on its pair: CHARGE_ACCUMULATED_FUNDING_FEE rows appear only for pairs on accumulated funding, and legacy pairs produce CHARGE_FUNDING_RATE rows. Whether a pair accrues accumulated funding is a per-pair deployment fact — see Funding › Pair states — so do not assume every row is one type.

Parameters

quoteIdsreadonly bigint[]required

On-chain quote ids to read events for. Order is irrelevant — rows come back merged. An empty array returns an empty page without issuing a request.

typesreadonly QuoteSubgraphEventType[]optional

Event types to include — SettleUpnl (SETTLE_UPNL), ChargeFundingRate (CHARGE_FUNDING_RATE), ChargeAccumulatedFundingFee (CHARGE_ACCUMULATED_FUNDING_FEE), one of the presets above, or any other subgraph type string. Omit to read every type; an empty array returns an empty page without issuing a request.

sourceAddressoptional

The deployment’s diamond address (the subgraph’s source). Omit to match the quote ids on any deployment the subgraph indexes; pass it when one subgraph indexes several diamonds, whose quote ids can collide.

firstnumberdefault 1000

Page size across the whole batch, not per quote id. The subgraph caps it at 1000, and omitting it asks for that ceiling.

skipnumberdefault 0

Page offset into the merged stream.

orderDirection"asc" | "desc"default desc

Sort direction on the event timestamp (newest first by default).

chainIdnumberoptional

Optional chain override.

Returns

GetQuotesEventsByTypeReturnType<TType>
rowsQuoteEventRow<TType>[]

The decoded event rows for every requested quote id, merged and sorted by timestamp server-side, type narrowed to the requested types. Same row shape as the single-quote action — each carries quoteId, type, timestamp, and the decoded metadata fields (fundingPaid, fundingReceived, rate, newPrice, prevPrice, …) whenever the underlying JSON held them. All amounts are 18-decimal wei bigint.

hasMoreboolean

true when the page came back full (rows.length === first) — fetch the next page by advancing skip.

Funding semantics

The metadata carries the raw on-chain amounts. Net a row the way the rest of the SDK does — fundingReceived − fundingPaid, so a positive net means the position earned funding on that tick, matching QuoteFundingData.netReceived. The raw fundingPaid / fundingReceived fields are verbatim from the subgraph and are never re-signed.

These are the charges settled to date, i.e. what the analytics subgraph has indexed. Funding that has accrued since a quote’s last on-chain charge is not in the subgraph and is therefore absent from the timeline — read it on-chain with getQuotePendingFunding.

The action does no event-type interpretation beyond decoding the metadata JSON.

Query options

import { FUNDING_HISTORY_EVENT_TYPES, getQuotesEventsByTypeQueryOptions } from "@symmio/trading-core"; import { useQuery } from "@tanstack/react-query"; useQuery( getQuotesEventsByTypeQueryOptions(config, { quoteIds: [7334n, 7335n], types: FUNDING_HISTORY_EVENT_TYPES, }), );

The query is disabled until at least one quote id is supplied, and while types is an empty array; omitting types reads every type. getQuotesEventsByTypeQueryKey stringifies the bigint ids and sorts them ascending, so passing the same ids in a different order shares one cache entry (the caller’s array is never mutated).

Last updated on