@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / buildFundingRateSeries

Function: buildFundingRateSeries()

buildFundingRateSeries<T>(rows, intervalSeconds, from, to, limit): FundingRateSeries<T>

Defined in: packages/sdk/src/funding.ts:277

Densify a page of rollup rows into a chart-ready series, and report whether the page was truncated.

Split out of the React hook on purpose: the truncation rule is the part that misleads if it is wrong, and it is worth asserting without a DOM. truncated is rows.length >= limitlistFundingRateCandles pages newest-first, so a FULL page means older buckets were dropped, NOT that funding stopped. A caller that renders a truncated window without saying so shows missing history as a funding pause; the densifier declines to invent those older slots, which is why the returned window can be shorter than [from, to) and why firstBucketStart is reported rather than assumed to equal from.

Type Parameters

T

T extends FundingBucketLike

Parameters

rows

readonly T[]

a page from listFundingRateCandles, any order

intervalSeconds

number

the grid resolution the rows were queried at

from

number | bigint

window start, unix seconds (snapped down to the grid)

to

number | bigint

window end, unix seconds (exclusive)

limit

number

the limit the page was requested with, for the truncation test

Returns

FundingRateSeries<T>