Skip to content

feat: carry simulation v2 - fix gains precision + add funding + GMX carry - #2106

Merged
Flotapponnier merged 1 commit into
devfrom
feat/fee-compare-carry-v2
Aug 27, 2026
Merged

feat: carry simulation v2 - fix gains precision + add funding + GMX carry#2106
Flotapponnier merged 1 commit into
devfrom
feat/fee-compare-carry-v2

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

What

  • Fix bToASim symmetric: HL→Gains projection (venueB=HL, venueA=Gains) was missing gainsFunding — now matches the aToBSim path
  • Fix Gains precision bug: GAINS_BORROW_PRECISION was 1e10 × per-block (1000x too high); corrected to 1e18 per-second via collaterals[3].borrowingFees.v2.pairParams
  • Add Gains funding projection: estimateGainsFundingFees() reads collaterals[3].fundingFees.pairData[i].lastFundingRatePerSecondP / 1e18; applied to both aToBSim and bToASim
  • Add GMX carry projection: when HL trades are projected onto GMX (or vice versa), uses the wallet's own GMX history to derive implied borrow + funding rates and applies them to the HL notional

Projection coverage after this PR

Direction Taker Borrow Funding
HL → Gains ✓ per-coin ✓ v6 per-sec ✓ v6 per-sec
Gains → HL ✓ per-coin - ✓ 8h history
HL → GMX ✓ implied ✓ implied
GMX → HL - -

@Flotapponnier
Flotapponnier merged commit 68fa208 into dev Aug 27, 2026
1 check failed
bakabhai993 pushed a commit to bakabhai993/OpenChainBench that referenced this pull request Sep 12, 2026
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.

1 participant