Skip to content

fix(sdks): use outcomeId in GET query for fetchOHLCV/fetchTrades#1162

Merged
realfishsam merged 1 commit into
mainfrom
fix/sdk-ohlcv-trades-query-key
Jun 19, 2026
Merged

fix(sdks): use outcomeId in GET query for fetchOHLCV/fetchTrades#1162
realfishsam merged 1 commit into
mainfrom
fix/sdk-ohlcv-trades-query-key

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Both Python and TS SDKs sent ?id=... for GET reads, but the server's method-verbs.json spec for fetchOHLCV and fetchTrades declares the first positional arg as outcomeId. The GET dispatcher (queryToArgs in core/src/server/app.ts) peels primitive args by spec name, then bundles every remaining query key into the object arg. Result: outcomeId arrived undefined, and the raw key id ended up inside params. Downstream fromMarketId(undefined) crashed with Cannot read properties of undefined (reading 'match').
  • The POST path was unaffected (it sends positional args: [outcomeId, params] directly), which is why fetchOrderBook etc. never tripped.
  • Also: default HL fetchOHLCV params to { resolution: '1h' } so the typecheck from fix(hyperliquid): default fetchOHLCV params to {} #1161 passes (resolution is required on OHLCVParams).

Verified locally

Started npm run server --workspace=pmxt-core on port 3847, then ran both SDKs:

Python SDK:

fetch_markets: 2 (first: Fallback)
fetch_events: 2 (first: 2026 World Cup Champion)
fetch_order_book: bids=9 asks=12
fetch_ohlcv: 25 candles
fetch_trades: 10

TypeScript SDK:

fetchMarkets: 2 (first: Fallback)
fetchEvents: 2 (first: 2026 World Cup Champion)
fetchOrderBook: bids=9 asks=12
fetchOHLCV: 24 candles
fetchTrades: 10

All for exchange='hyperliquid'.

Test plan

Note on hosted MCP

The original failures I saw via the hosted MCP (fetchMarkets/fetchEvents returning [] for HL) do not reproduce locally against current main. Likely hosted-server version drift. Not in scope for this PR.

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'.
@realfishsam realfishsam merged commit b5a6ef3 into main Jun 19, 2026
9 of 12 checks passed
@realfishsam realfishsam deleted the fix/sdk-ohlcv-trades-query-key branch June 19, 2026 06: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.

1 participant