Skip to content

fix(hyperliquid): default fetchOHLCV params to {}#1161

Merged
realfishsam merged 1 commit into
mainfrom
fix/hyperliquid-fetchohlcv-default-params
Jun 19, 2026
Merged

fix(hyperliquid): default fetchOHLCV params to {}#1161
realfishsam merged 1 commit into
mainfrom
fix/hyperliquid-fetchohlcv-default-params

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • HL fetchOHLCV(outcomeId, params) had params typed as required. Server's flat-body dispatch (app.ts) merges body fields into a single object and passes it as args[0], leaving args[1] undefined.
  • Result: any MCP/HTTP call to fetchOHLCV for Hyperliquid crashes with Cannot read properties of undefined (reading 'start').
  • Other HL read methods (fetchOrderBook, fetchTrades) already make params optional and work fine.

Repro

mcp pmxt.fetchOHLCV {exchange: 'hyperliquid', outcomeId: 'hl-outcome-172', resolution: '1h'}
→ PMXT API error: Cannot read properties of undefined (reading 'start')

Test plan

  • After deploy, re-run the MCP call above — expect candle array (or empty, not crash)
  • Re-run with explicit start/end ISO strings — still works

Known not fixed in this PR

  • fetchMarkets / fetchEvents return [] for exchange=hyperliquid despite loadMarkets returning ~6000 markets. Root cause not yet identified from code reading; needs local repro against npm run dev.
  • outcomeId parameter on HL read methods actually expects a marketId (hl-outcome-{n}), not the encoded outcome token id from loadMarkets[].outcomes[].outcomeId. Either the param naming or the handler is wrong — separate issue.

…survives

Server's flat-body dispatch passes a single merged object as args[0],
leaving args[1] undefined. The other HL read methods make params
optional; OHLCV did not, so calls without explicit start/end crashed
with 'Cannot read properties of undefined (reading start)'.

Reproduces via MCP: pmxt.fetchOHLCV({exchange:'hyperliquid', outcomeId:'hl-outcome-172', resolution:'1h'}).
@realfishsam realfishsam merged commit 0bf85bc into main Jun 19, 2026
8 of 11 checks passed
@realfishsam realfishsam deleted the fix/hyperliquid-fetchohlcv-default-params branch June 19, 2026 05:46
realfishsam added a commit that referenced this pull request Jun 19, 2026
SDKs were sending '?id=...' for GET reads, but server method-verbs
spec defines the first arg as 'outcomeId'. The GET dispatcher uses
spec names to peel primitive args, then bundles every other query key
into the object arg. So outcomeId arrived as undefined and the raw
key 'id' ended up inside params. fromMarketId(undefined) crashed
with 'Cannot read properties of undefined (reading match)'.

POST path was unaffected because it sends positional args directly.

Also: default HL fetchOHLCV params to a benign value so the build
fix from #1161 type-checks (resolution is required on OHLCVParams).

Verified locally against npm run server with both Python and TS SDKs:
  fetch_markets, fetch_events, fetch_order_book, fetch_ohlcv, fetch_trades
all return data for exchange='hyperliquid'.
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