Skip to content

fix: correct allMids lookup key in hyperliquid normalizer#595

Merged
realfishsam merged 1 commit into
mainfrom
fix/441-hyperliquid-prices
May 24, 2026
Merged

fix: correct allMids lookup key in hyperliquid normalizer#595
realfishsam merged 1 commit into
mainfrom
fix/441-hyperliquid-prices

Conversation

@realfishsam
Copy link
Copy Markdown
Contributor

Fixes #441

@realfishsam
Copy link
Copy Markdown
Contributor Author

PR Review: VERIFIED

What This Does

Fixes the allMids lookup key used in the Hyperliquid normalizer and fetcher. The allMids API endpoint keys prediction-market outcomes as @{outcomeId} (e.g. @8), not the #{encoding} coin notation used for orders/positions. This was causing mid-price lookups to silently miss, defaulting all prices to 0.5.

Blast Radius

  • core/src/exchanges/hyperliquid/fetcher.ts -- getMidForOutcome() now uses toMidKey()
  • core/src/exchanges/hyperliquid/normalizer.ts -- normalizeEventWithMarkets() now uses toMidKey()
  • core/src/exchanges/hyperliquid/utils.ts -- new toMidKey() utility added

No SDK or OpenAPI changes needed since this is a core-internal data lookup fix.

Findings

No blocking findings. The change is clean: a new pure function is introduced, imports are updated, and both call sites (fetcher + normalizer) are updated consistently.

PMXT Pipeline Check

  • Field propagation: N/A (no new fields)
  • OpenAPI sync: N/A (no API surface change)
  • Type safety: OK

Semver Impact

patch -- bug fix for incorrect price lookups on Hyperliquid

Risk

The @{outcomeId} key format is not documented in a spec; it was inferred from the live API. If Hyperliquid changes this format, the lookup will silently miss again and fall back to 0.5. No test covers the toMidKey mapping against a real or mocked allMids response.

@realfishsam realfishsam merged commit 8517bd2 into main May 24, 2026
11 of 12 checks passed
@realfishsam realfishsam deleted the fix/441-hyperliquid-prices branch May 24, 2026 17:03
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.

Response drift: hyperliquid — allMids price lookup always misses, prices hardcoded to 0.5

1 participant