getFundingIndexCheckpoints
The funding-rate index of one market and PartyB at points in time, from the analytics subgraph’s fundingIndexCheckpoints collection. Each checkpoint is written by an event (eventType) and records the raw and current long / short rates, the accumulated rate index, the epoch configuration, and the fee snapshots. Reach for it to find the index a quote’s funding was measured against at a given moment, or as one of the raw inputs of a per-epoch funding timeline.
import { getFundingIndexCheckpoints } from "@symmio/trading-core";
const { rows, hasMore } = await getFundingIndexCheckpoints(config, {
marketIds: [42],
partyBs: [solver],
startTime: openedAt,
orderDirection: "asc",
});Every filter is optional and applied only when passed; an empty list filter reads nothing. One call returns one page — see Filters and paging for the shared rules and for paging by cursor.
The checkpoint in force at a moment
The latest checkpoint at or before a moment is one row: bound the time from above with endTime, sort newest first, and take one.
const { rows } = await getFundingIndexCheckpoints(config, {
source: diamond,
marketIds: [42],
partyBs: [solver],
endTime: openedAt,
orderDirection: "desc",
first: 1,
});
const checkpoint = rows[0]; // undefined when none was written before `openedAt`Parameters
sourceAddressoptionalThe deployment’s diamond address (the subgraph’s source).
marketIdsreadonly number[]optionalMarket ids (symbolId).
partyBsreadonly Address[]optionalPartyB (solver) addresses.
startTimenumberoptionalLower bound on the block timestamp (unix seconds, inclusive).
endTimenumberoptionalUpper bound on the block timestamp (unix seconds, inclusive).
firstnumberdefault 1000Page size, 1–1000.
skipnumberdefault 0Rows to skip. The Graph rejects values above 5000.
orderBy"timestamp" | "id"default timestampSort field. Defaults to "id" when idGt is set.
orderDirection"asc" | "desc"default descSort direction. Defaults to "asc" when idGt is set.
idGtstringoptionalCursor: only checkpoints whose id sorts after this one. Sorts by id ascending unless a sort is passed; any other
sort throws INVALID_SUBGRAPH_CURSOR. See Paging by cursor.
chainIdnumberoptionalOptional chain override.
Returns
GetFundingIndexCheckpointsReturnTyperowsFundingIndexCheckpointRow[]The decoded checkpoints of this page.
hasMorebooleantrue when the page came back full, so another page may exist.
FundingIndexCheckpointRow
Rates and fees are 18-decimal bigint, passed through as indexed. A null marks a field the subgraph has not indexed for this checkpoint — never read it as zero.
FundingIndexCheckpointRowidstringSubgraph entity id — stable; use it as a row key or idGt cursor.
sourceAddressDiamond address the checkpoint was indexed from.
symbolIdnumberMarket id.
partyBAddressPartyB, the solver.
eventTypestringThe event that wrote the checkpoint, as indexed.
rawLongRatebigint | nullRaw long rate, before the market-price conversion.
rawShortRatebigint | nullRaw short rate, before the market-price conversion.
marketPricebigint | nullMarket price the rates were converted at.
currentLongRatebigint | nullCurrent long rate.
currentShortRatebigint | nullCurrent short rate.
accumulatedLongRatebigint | nullAccumulated long rate — the index.
accumulatedShortRatebigint | nullAccumulated short rate — the index.
epochDurationbigint | nullEpoch length, seconds.
lastUpdatedEpochbigint | nullLast updated epoch.
startEpochbigint | nullFirst epoch.
startEpochTimestampnumber | nullFirst epoch’s start, unix seconds.
snapshotLongFeebigint | nullLong fee snapshot.
snapshotShortFeebigint | nullShort fee snapshot.
timestampnumberBlock timestamp, unix seconds.
blockNumberbigintBlock number.
transactionHexTransaction hash.
Query options
import { getFundingIndexCheckpointsQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getFundingIndexCheckpointsQueryOptions(config, { marketIds: [42], partyBs: [solver] }));The query is disabled while marketIds or partyBs is an empty array.
Related
getQuoteFundingSettlements— each settlement on a quote, with the index it paid through.getFundingFeesOfPartyB— the pair’s live on-chainFundingFeestate.- Funding › Pair states — when a pair accrues accumulated funding at all.
- React
useFundingIndexCheckpoints— the hook over this action.