fix(hyperliquid): honor marketId/eventId filters and OHLCV/trades limit - #1254
Merged
Merged
Conversation
HL fetcher silently ignored four filters that the unified API contract
promises:
- fetchRawMarkets ignored params.marketId — fetchMarket(marketId=X)
returned the first market in the venue list instead of X
- fetchRawMarkets / fetchRawEvents ignored params.eventId — fetchEvent
always returned the first question
- fetchRawOHLCV ignored params.limit — returned the entire window
- fetchRawTrades ignored params.limit — returned a fixed page
These all passed the prior smoke matrix because it only checked
'did the call throw'. The new assertion-based verify suite catches
each one (45/45 pass after fix, both SDKs).
marketId filter uses fromMarketId so it accepts either canonical
hl-outcome-{N} or a raw outcome token, matching the resolution we
added for fetchOrderBook / fetchOHLCV / fetchTrades single-fetch.
Limit slicing is client-side after the venue call returns, since HL's
candleSnapshot and recentTrades both return a fixed window/page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Assertion-based SDK verification surfaced 4 silent HL bugs the prior "did it throw" matrix missed:
fetchMarket(marketId=X)returned the first marketfetchRawMarketsignoredparams.marketIdfromMarketId(accepts canonical id or outcome token)fetchEvent(eventId=X)returned the first eventfetchRawEventsignoredparams.eventIdfetchMarkets(eventId=X)not filteredfetchOHLCV(..., limit=N)returned full windowfetchRawOHLCVdidn't slicefetchTrades(..., limit=N)returned fixed pagefetchRawTradesdidn't sliceLimit slicing happens client-side because HL's
candleSnapshotandrecentTradesboth return a fixed window/page.Verified locally (both SDKs)
Before fix: Python 41/45, TS 42/45.
After fix: Python 45/45, TS 45/45.
Test script asserts behavioral properties (id round-trips, monotonic timestamps, OHLC sanity, length bounds, no crossed book, etc.) — not just "call didn't throw".
Followup worth doing
Mirror this verify pattern for the other venues. The 'did it throw' matrix style hid HL's hardcoded
volume24h: 0for months and would hide the same class of bug elsewhere.