Skip to content

fix: augment HL position reconstruction with clearinghouseState - #2159

Merged
Flotapponnier merged 2 commits into
devfrom
fix/hl-fill-cap
Aug 27, 2026
Merged

fix: augment HL position reconstruction with clearinghouseState#2159
Flotapponnier merged 2 commits into
devfrom
fix/hl-fill-cap

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Problem

HL userFills API is capped at 2000 fills per call. Active traders with more than 2000 fills have positions whose open fill is outside the cap window. These positions:

  • Generate real HL funding (captured by userFunding which has no cap)
  • Are invisible to reconstructHlPositions (no fill in the returned data)

This caused the Gains/dYdX/Paradex carry projection to be severely underestimated for heavy traders, while HL's actual funding ($834 in the example) looked disproportionately large vs the projected carry ($2.83).

Fix

Fetch clearinghouseState (current open positions) alongside fills and funding. After reconstructHlPositions, call augmentWithHlOpenPositions which adds any currently-open position not already captured by the fill reconstruction (keyed by coin:side).

These positions get a slice from cutoffMs → now, which is the same window used by userFunding. This makes the carry projection consistent with the actual HL funding data.

Applied to all 4 call sites of reconstructHlPositions (HL→Gains aToBSim, HL→Gains bToASim, generic aToBSim, generic bToASim).

Test plan

  • HL wallet with many fills: Gains/dYdX funding projection should now be meaningfully higher (not near-$0) when trader has large open positions
  • HL wallet with few fills (< 2000): no change (clearinghouseState positions were already in fill reconstruction)
  • No regression on venues without HL

@Flotapponnier
Flotapponnier merged commit de9247b into dev Aug 27, 2026
1 check failed
Flotapponnier added a commit that referenced this pull request Aug 27, 2026
* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)
Flotapponnier added a commit that referenced this pull request Aug 28, 2026
* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix(sitemap): filter removed benches, HL spec slugs, add zerion/routescan to removed products

* fix(sitemap): isHlBuilderSlug filter + exclude REMOVED_BENCH_SLUGS from categories

* sync: merge dev into main (benches 246-249 + recent fixes) (#2167)

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro (#2170)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: use query params for shareable URL instead of broken path format
Flotapponnier added a commit that referenced this pull request Aug 28, 2026
* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay bench YAMLs (#2168)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249)

* fix(rpc): remove em dashes from seo_intro in acala/babylon/interlay YAMLs

* fix: direction-aware funding projection for all venues (#2163)

* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix: direction-aware funding projection for all venues

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: correct Robinhood Chain launch date and remove unverified provider claim (#2174)

* feat: pre-fill wallet from URL params on fee-compare (#2176)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* feat: pre-fill wallet/venues from URL search params on fee-compare page

* fix: shareable URL uses query params not broken path format (#2177)

* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix(sitemap): filter removed benches, HL spec slugs, add zerion/routescan to removed products

* fix(sitemap): isHlBuilderSlug filter + exclude REMOVED_BENCH_SLUGS from categories

* sync: merge dev into main (benches 246-249 + recent fixes) (#2167)

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro (#2170)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: use query params for shareable URL instead of broken path format

* fix: split Gains taker vs vault fee, add per-trade equiv fee column (#2178)
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