@somnia-chain/markets-sdk


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

Function: realizedFundingPerBase()

realizedFundingPerBase(cumulativeStart, cumulativeEnd): bigint

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

Realized funding over a range, in raw quote units per WHOLE base unit.

Takes the two cumulative-index samples rather than a rate, because the cumulative index is the ground truth for accrual: the difference is exact over any range, with no interpolation, no zero-fill reasoning and no cap arithmetic. A rate-based estimate is not equivalent — it cannot see forgiven intervals or index-price movement.

The result is in RAW quote units (atoms). To show it as a token amount, divide by 10 ** quoteDecimals — and note the collateral is 18dp on the live deployment, so a human figure is (end - start) / 1e18 / 1e18. Treating the returned value as whole tokens overstates it by the quote scale.

Signed: positive means longs paid shorts over the range.

Parameters

cumulativeStart

bigint

cumulativeEnd

bigint

Returns

bigint