Skip to content

fix: fee-compare apples-to-apples accuracy (paginated funding, multi-slice, comparable notional) - #2217

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

fix: fee-compare apples-to-apples accuracy (paginated funding, multi-slice, comparable notional)#2217
Flotapponnier merged 1 commit into
devfrom
feat/fee-compare-accuracy-v2

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Summary

  • F1 — paginated HL funding history: fetchHlFundingHistory now fetches up to 5 pages × 500 entries, covering 180d+ windows (before it silently stopped at 500 entries / ~167 days)
  • F4 — multi-slice position reconstruction: reconstructGainsPositions now emits one PositionSlice per size-change period per position instead of one slice using the final post-increase notional for the entire window; pre-increase periods now use the correct (smaller) notional
  • F5 — comparable notional: tracks comparableNotionalUsdc (HL-listed coins only) and walletStats uses it for the Gains→HL sim, so the HL taker-equiv fee isn't inflated by PONS/Gains-exclusive trade volume; Gains-exclusive fees are also subtracted from the Gains actual total
  • HL-comparable greying (from previous PRs feat: apples-to-apples fee comparison (HL-comparable coins only) #2215/fix: HL funding projection accuracy #2216): Gains-only pairs show "Gains only" badge and are greyed out in the trade table

What was wrong before

Issue Old behaviour After fix
180d HL funding Collapsed to 0 (500-entry cap) Paginated, up to ~833d coverage
Gains positions with increases Used final (larger) notional for full window Correct notional per size-change period
PONS/exclusive coins in HL equiv Inflated HL notional by non-HL trades Filters to HL-available coins only
Gains actual fees in comparison Included fees on non-HL coins Subtracts exclusive-coin fees

Test plan

  • Gains vs HL with 180d window: HL funding projection should be non-zero
  • Gains wallet with PONS trades: exclusive badge shown, excluded from comparison total
  • Both comparison directions render correctly (A→B and B→A)
  • TypeScript passes (npx tsc --noEmit)

…ns, comparable notional

F1: paginate fetchHlFundingHistory (up to 5 pages × 500) to cover 180d+ windows
F4: multi-slice reconstructGainsPositions — one PositionSlice per size-change period
    so pre-increase periods use smaller notional (more accurate HL equiv funding)
F5: track comparableNotionalUsdc (HL-listed coins only) and use it in walletStats
    so the HL taker-equiv fee isn't inflated by PONS/Gains-exclusive notional
@Flotapponnier
Flotapponnier merged commit ac3504b into dev Aug 30, 2026
1 check failed
@Flotapponnier
Flotapponnier deleted the feat/fee-compare-accuracy-v2 branch August 30, 2026 21:51
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