@somnia-chain/markets-sdk


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

Type Alias: FundingRateCandle

FundingRateCandle = object

Defined in: packages/sdk/src/perp/history.ts:268

A funding-rate rollup bucket (mirror of the indexer FundingRateCandle) — for charting ranges the raw series is too dense for.

Each bucket is built by distributing every settlement across the buckets its covered span overlaps, weighted by seconds and normalized to a fixed per-8h axis. That is not an implementation detail: crediting a lazily-settled emit to the bucket containing its log renders an 8x phantom spike on the testnet cadence and 3x on the expected mainnet one, while the buckets the funding actually applied to render as paused.

Properties

id

id: string

Defined in: packages/sdk/src/perp/history.ts:270

Bucket id (${pool}_${intervalSeconds}_${bucketStart}).


pool

pool: string

Defined in: packages/sdk/src/perp/history.ts:271


intervalSeconds

intervalSeconds: number

Defined in: packages/sdk/src/perp/history.ts:273

3600 | 14400 | 86400.


bucketStart

bucketStart: string

Defined in: packages/sdk/src/perp/history.ts:275

Bucket start (unix seconds).


avgFundingRate8h

avgFundingRate8h: string

Defined in: packages/sdk/src/perp/history.ts:282

Seconds-weighted mean rate, already on a per-8h basis, and zero-filled: seconds no settlement covered pull the mean toward zero rather than being dropped. So a partially covered bucket reads BELOW the rate that was in force — read coverage to tell that apart from a genuinely small rate.


minFundingRate8h

minFundingRate8h: string | null

Defined in: packages/sdk/src/perp/history.ts:288

Extremes over CONTRIBUTING settlements only — undiluted by coverage and NOT zero-filled, so they can legitimately sit outside avgFundingRate8h on a thinly covered bucket. Null when no settlement's span reached this bucket.


maxFundingRate8h

maxFundingRate8h: string | null

Defined in: packages/sdk/src/perp/history.ts:289


coverage

coverage: string

Defined in: packages/sdk/src/perp/history.ts:295

Covered seconds / bucket seconds, 1e18-scaled — a true ratio in [0, 1]. This is what a chart should hatch or grey on: a bucket at avgFundingRate8h: 0 with low coverage is a PAUSE, not a measurement of zero funding.


cumulativeFundingStart

cumulativeFundingStart: string

Defined in: packages/sdk/src/perp/history.ts:313

Cumulative funding index at this bucket's wall-clock START and END, attributed by covered seconds — the same basis as avgFundingRate8h.

Two exact properties follow, and both are what this pair is for:

  • Sparse buckets telescope. cumulativeFundingEnd equals the next existing bucket's cumulativeFundingStart, even across a gap no settlement covered — the index is flat over uncovered time, so there is nothing to attribute.
  • Range sums are exact. sum(end - start) over any set of buckets is the funding that accrued over them; see realizedFundingPerBase.

These are ATTRIBUTION values, not chain samples. A catch-up settlement's whole span is spread across the buckets it covered rather than booked at its log, so an interior edge deliberately will NOT equal any FundingRateUpdate.cumulativeFundingPerUnit. Use client.listFundingRateHistory when you want the sampled series itself.


cumulativeFundingEnd

cumulativeFundingEnd: string

Defined in: packages/sdk/src/perp/history.ts:314


fundingWindowSec

fundingWindowSec: number

Defined in: packages/sdk/src/perp/history.ts:316

Params at the bucket's last settlement; paramsChangedInBucket flags a mid-bucket change.


fundingIntervalSec

fundingIntervalSec: number

Defined in: packages/sdk/src/perp/history.ts:317


paramsChangedInBucket

paramsChangedInBucket: boolean

Defined in: packages/sdk/src/perp/history.ts:318


indexPriceEnd

indexPriceEnd: string | null

Defined in: packages/sdk/src/perp/history.ts:319


openInterestEnd

openInterestEnd: string | null

Defined in: packages/sdk/src/perp/history.ts:320


updateCount

updateCount: number

Defined in: packages/sdk/src/perp/history.ts:322

How many settlements contributed to this bucket.