Skip to content

fix(sdks): HL fromMarketId accepts outcome tokens; add fetchEventsPaginated - #1252

Merged
realfishsam merged 1 commit into
mainfrom
fix/hl-accept-outcome-token-add-events-paginated
Jun 21, 2026
Merged

fix(sdks): HL fromMarketId accepts outcome tokens; add fetchEventsPaginated#1252
realfishsam merged 1 commit into
mainfrom
fix/hl-accept-outcome-token-add-events-paginated

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

Two fixes uncovered by the HL SDK matrix audit:

  1. HL fetchOrderBook/fetchOHLCV/fetchTrades rejected real outcome tokens. The param is named outcomeId but the handler only accepted the canonical hl-outcome-{N} form. Passing an actual outcome token (e.g. 100002000, as returned by UnifiedMarket.outcomes[].outcomeId) threw Invalid Hyperliquid market ID: 100002000. fromMarketId() now accepts either form via decodeAssetId.

  2. fetchEventsPaginated was missing from both SDKs. BaseExchange.fetchEventsPaginated existed but neither client.py nor client.ts exposed a wrapper. Added fetch_events_paginated / fetchEventsPaginated mirroring the existing fetchMarketsPaginated pattern.

Verified locally (Python + TS) against npm run server

fetchEventsPaginated         OK
fetchOrderBook(outcomeTok)   OK
fetchOHLCV(outcomeTok)       OK
fetchTrades(outcomeTok)      OK

Not in scope (reminder, untested without creds)

fetchBalance, fetchPositions, fetchOpenOrders, fetchMyTrades, fetchClosedOrders, fetchAllOrders, fetchOrder, cancelOrder, submitOrder, createOrder.

…inated

Hyperliquid:
- fromMarketId() now accepts either canonical hl-outcome-{N} OR a raw
  encoded asset token (the numeric outcomeId returned by
  UnifiedMarket.outcomes[].outcomeId). The 'outcomeId' parameter on
  fetchOrderBook / fetchOHLCV / fetchTrades was rejecting real outcome
  tokens because it only matched the hl-outcome-* form. Now callers can
  pass either, matching the param's documented name.

SDKs:
- BaseExchange.fetchEventsPaginated existed but neither the Python nor
  TS client exposed it. Added fetch_events_paginated /
  fetchEventsPaginated wrappers mirroring the existing
  fetchMarketsPaginated pattern.

Verified locally against npm run server, both SDKs:
  fetchEventsPaginated         OK
  fetchOrderBook(outcomeTok)   OK
  fetchOHLCV(outcomeTok)       OK
  fetchTrades(outcomeTok)      OK
@realfishsam
realfishsam merged commit e53a164 into main Jun 21, 2026
7 of 12 checks passed
@realfishsam
realfishsam deleted the fix/hl-accept-outcome-token-add-events-paginated branch June 21, 2026 16:37
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