Skip to content

[SDK] Add funding-rate data model - #908

Closed
CARTEL-L wants to merge 2 commits into
drydocs:mainfrom
CARTEL-L:sdk-add-funding-rate-data-model
Closed

CARTEL-L wants to merge 2 commits into
drydocs:mainfrom
CARTEL-L:sdk-add-funding-rate-data-model

Conversation

@CARTEL-L

@CARTEL-L CARTEL-L commented Sep 27, 2026 •

Copy link
Copy Markdown

Closes #864

Summary

Adds a funding-rate data model for representing periodic funding payments on perpetual and basis positions.

This implementation:

  • Models funding rates as signed fixed-point rates with an associated interval.
  • Represents a funding-rate series aligned to simulation time.
  • Provides funding accrual calculations for a notional position across a given time span.
  • Defines and documents sign conventions for funding paid and funding received.
  • Exports the funding-rate model and accrual helper from the package index.

Changes

  • Added FundingRate data model using fixed-point decimal rates.
  • Added funding-rate series representation aligned to the simulation clock.
  • Implemented an accrual helper for calculating funding payments over one or more intervals.
  • Added handling for empty series and gap intervals, which accrue zero funding.
  • Documented funding sign conventions and expected behavior.
  • Exported funding-related models and helpers through the package index.

Test Plan

  • Positive funding accrual
  • Negative funding accrual
  • Single-interval accrual
  • Multi-interval accrual
  • Empty series accrues zero
  • Gap-containing series accrues zero over gaps
  • Fixed-point precision maintained for rates and accrued amounts

Commands Run

pnpm --filter @meridian/strategies test
pnpm lint
pnpm typecheck

@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@CARTEL-L is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@CARTEL-L
CARTEL-L force-pushed the sdk-add-funding-rate-data-model branch from 182b0a3 to 14b190d Compare September 30, 2026 20:02
@collinsezedike

Copy link
Copy Markdown
Collaborator

@CARTEL-L thank you for this. I am closing it instead of merging, because funding.ts landed on main in #951 and this PR is an add/add conflict against it on all six files.

The merged version uses FixedPointDecimal from types.ts, which is the package's stroops type and is already exported from the index. This PR declares its own interface FixedPointDecimal at funding.ts:4 under the same exported name, so the two cannot both be re-exported and the package would fail to compile with a duplicate export. index.ts here replaces the package's export list with a single line, and package.json and vitest.config.ts conflict with main as well.

Issue #864 is closed and is covered by the merged funding.ts. Several issues on the board are still open if you would like to pick up another one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SDK] Add funding-rate data model

2 participants