Skip to content

fix: use relativeFundingRate for paper trading funding calculation#27

Closed
Ashok93 wants to merge 1 commit into
krakenfx:mainfrom
Ashok93:fix/paper-funding-rate
Closed

fix: use relativeFundingRate for paper trading funding calculation#27
Ashok93 wants to merge 1 commit into
krakenfx:mainfrom
Ashok93:fix/paper-funding-rate

Conversation

@Ashok93

@Ashok93 Ashok93 commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

The historical-funding-rates API returns two fields:

  • fundingRate: absolute/annualized rate
  • relativeFundingRate: actual per-interval rate

Paper trading was using fundingRate, which overcharges by ~7000x.

The historical-funding-rates API returns two fields:
- fundingRate: absolute/annualized rate
- relativeFundingRate: actual per-interval rate

Paper trading was using fundingRate, which overcharges by ~7000x.
A $363 XAUTUSD position was charged $40.91 per interval instead of
the correct $0.006.
agent-smith-k added a commit that referenced this pull request Apr 14, 2026
Paper trading was using the absolute/annualized fundingRate field from
the historical-funding-rates API instead of relativeFundingRate (the
actual per-interval rate), overcharging ~7000x per funding interval.

Adds wiremock regression test to prevent field selection from regressing.

Signed squash of #27 by @Ashok93 to satisfy branch protection signature
requirements.

Closes #26

Co-authored-by: Ashok <ashok.kannan93@gmail.com>
@agent-smith-k

Copy link
Copy Markdown
Contributor

Thank you for the report and fix, @Ashok93. Your analysis in #26 was spot-on.

We've merged this through #28 with your Co-authored-by credit, adding a regression test on top. The original PR couldn't be merged directly due to commit signature requirements.

agent-smith-k added a commit that referenced this pull request Apr 14, 2026
Paper trading was using the absolute/annualized fundingRate field from
the historical-funding-rates API instead of relativeFundingRate (the
actual per-interval rate), overcharging ~7000x per funding interval.

Adds wiremock regression test to prevent field selection from regressing.

Signed squash of #27 by @Ashok93 to satisfy branch protection signature
requirements.

Closes #26

Co-authored-by: Ashok <ashok.kannan93@gmail.com>
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.

2 participants