@somnia-chain/markets-sdk / index / FundingRateUpdate
Type Alias: FundingRateUpdate
FundingRateUpdate =
object
Defined in: packages/sdk/src/perp/history.ts:327
A funding-rate history point (mirror of the indexer FundingRateUpdate
entity) — the append-only counterpart to the market row's overwrite-only
funding fields.
Properties
id
id:
string
Defined in: packages/sdk/src/perp/history.ts:329
Update id (${pool}_${block}_${logIndex}).
pool
pool:
string
Defined in: packages/sdk/src/perp/history.ts:331
Perp pool (lowercased).
fundingRate
fundingRate:
string
Defined in: packages/sdk/src/perp/history.ts:337
Rate applied to THIS settlement, per CALCULATION WINDOW, 1e18-scaled, signed.
Normalize with fundingWindowSec on this same row — see
normalizeFundingRate.
cumulativeFundingPerUnit
cumulativeFundingPerUnit:
string
Defined in: packages/sdk/src/perp/history.ts:344
Cumulative funding index AFTER this settlement (1e18 x quote units per whole base,
signed, NOT monotonic). The ground truth for accrual: realized funding over any
range is exactly (end - start) / 1e18 raw quote units per whole base, with no
interpolation and no gap reasoning. See realizedFundingPerBase.
indexPrice
indexPrice:
string
Defined in: packages/sdk/src/perp/history.ts:346
Oracle index price at the update (raw quote per whole base, 18dp).
markPrice
markPrice:
string|null
Defined in: packages/sdk/src/perp/history.ts:354
Best-effort mark-price cross-check. NULL when the contract emitted its 0 sentinel for a stale/reverting mark feed — never a price of zero. Unrelated to the premium driving the rate, which since DEX-2252 is the time-weighted IMPACT-price premium (quantity-weighted fill price at a configured notional on each side, deadbanded against the index), not a book midpoint.
intervalsSettled
intervalsSettled:
string
Defined in: packages/sdk/src/perp/history.ts:366
Intervals SPANNED, unclamped, as emitted — the timeline the anchor advanced over, not what accrued.
This alone does not tell you whether anything was forgiven. Compare it against
intervalsAccrued: they are equal when the settlement charged its whole span, and
intervalsAccrued is lower when the rest was forgiven at zero. A value above 1 is
not enough on its own, because rows from before the one-interval horizon can have
BOTH counts above 1 — a row spanning 264 intervals and accruing 96 forgave 168, and
a row spanning 96 and accruing 96 forgave nothing.
intervalsAccrued
intervalsAccrued:
string
Defined in: packages/sdk/src/perp/history.ts:379
What actually accrued, which is not min(intervalsSettled, n) — do not
re-derive it that way. The contract's catch-up horizon charges at most one
interval per settlement however long the gap, so a value below intervalsSettled
means the excess was FORGIVEN at zero funding rather than deferred. The forgiven
intervals are the OLDEST ones.
The indexer recovers this from the cumulative-index delta the settlement actually
moved, rather than reading it off intervalsSettled, because the horizon belongs to
the deployed contract and has changed more than once. So a row is correct for the
implementation that produced it, anywhere in backfilled history.
fundingWindowSec
fundingWindowSec:
number
Defined in: packages/sdk/src/perp/history.ts:381
The rate's denominator in seconds, in force at this emit. Makes the row self-normalizing.
fundingIntervalSec
fundingIntervalSec:
number
Defined in: packages/sdk/src/perp/history.ts:383
Settlement cadence in seconds, in force at this emit.
spanStart
spanStart:
string
Defined in: packages/sdk/src/perp/history.ts:394
Wall-clock span this settlement's accrual covers — the last intervalsAccrued
intervals ending at the settlement anchor. It reaches BACKWARDS from the emit, which
is why a funding chart must distribute a row across the buckets its span overlaps
rather than credit it to the bucket containing it.
At the deployed one-interval horizon that span is usually one interval wide, so the distribution matters most for older rows: under the earlier horizons one lazily settled emit could cover a full calculation window.
spanEnd
spanEnd:
string
Defined in: packages/sdk/src/perp/history.ts:395
anchorResynced
anchorResynced:
boolean
Defined in: packages/sdk/src/perp/history.ts:402
True when the settlement anchor had to be re-derived because the chain advanced it with NO event — the stale-oracle-with-zero-open-interest branch, where funding is permanently forgiven at zero and nothing is logged. A run of these means some funding time is covered by no row at all.
timestamp
timestamp:
string
Defined in: packages/sdk/src/perp/history.ts:404
Timestamp (unix seconds) of the update.
blockNumber
blockNumber:
string
Defined in: packages/sdk/src/perp/history.ts:405
txHash
txHash:
string
Defined in: packages/sdk/src/perp/history.ts:406