getQuoteFunding
Settled funding totals — paid, received, and net — for a batch of quotes, read from the analytics subgraph.
import { getQuoteFunding } from "@symmio/trading-core";
const { rows, missingQuoteIds } = await getQuoteFunding(config, {
quoteIds: [42n, 43n],
});Settled to date only. The totals cover funding the protocol has already charged and the subgraph has indexed. Funding accrued since a quote’s last settlement is not in the subgraph — read it on-chain with getQuotePendingFunding. The two come from different sources at different heights, so show them as separate figures rather than one lifetime total; Funding explains why.
Parameters
quoteIdsreadonly bigint[]requiredOn-chain quote ids to read funding for. Any length — the action chunks the list into requests of at most 1000 ids and merges the responses. An empty array returns empty results without a request.
sourceAddressoptionalThe deployment’s diamond address (the subgraph’s source). Omit to match each quote id on any deployment the
subgraph indexes. Pass it when one subgraph indexes several diamonds, whose quote ids can collide — otherwise one id
can return a row per diamond.
chainIdnumberoptionalOptional chain override.
Returns
GetQuoteFundingReturnTyperowsQuoteFundingData[]{ quoteId, paid, received, netReceived } — all amounts are 18-decimal-wei bigint, and netReceived = received − paid (positive means the position has earned funding to date; negative means it has paid for it).missingQuoteIdsbigint[]Query options
import { getQuoteFundingQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getQuoteFundingQueryOptions(config, { quoteIds: [42n] }));Related
getQuoteFundingSettlements— the individual settlements behind these totals.getSubgraphQuotes— the same totals with the rest of the indexed quote.- Funding — settled vs pending, and the sign convention.