Skip to content

fix(hyperliquid): populate volume24h; fix Kalshi error class kwargs - #1219

Merged
realfishsam merged 1 commit into
mainfrom
fix/hl-volume24h-and-kalshi-error
Jun 21, 2026
Merged

fix(hyperliquid): populate volume24h; fix Kalshi error class kwargs#1219
realfishsam merged 1 commit into
mainfrom
fix/hl-volume24h-and-kalshi-error

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

Hyperliquid volume24h was hardcoded to 0 in normalizer.ts for every market and event. Fixed by pulling dayNtlVlm from spotMetaAndAssetCtxs (where outcome legs appear as coin: '#NNNN'), summing Yes+No notional per outcome, and threading the map through fetchRawMarkets / fetchEventsImpl. One extra batched call, no N+1.

Python SDK Kalshi crash: NetworkError / ExchangeNotAvailable __init__ signatures rejected the code/retryable kwargs that from_server_error always passes. Any 503 raised TypeError: ExchangeNotAvailable.__init__() got an unexpected keyword argument 'code' instead of a typed PmxtError. Both classes now accept **kwargs and default-fill their hardcoded values.

Verified locally via Python SDK against npm run server

fetch_events(exchange='hyperliquid', query='World Cup', limit=8):

$2,211,178  2026 World Cup Champion
$  761,324  World Cup: Spain vs Saudi Arabia
$  400,211  World Cup: Uruguay vs Cape Verde
$  387,893  World Cup: Belgium vs Iran
$  337,734  World Cup: New Zealand vs Egypt
...

Top HL markets by volume24h:

$483,017  Netherlands
$419,547  Germany
$386,582  BTC > $64,223 @ 2026-06-22 06:00 UTC
$356,995  Spain
$261,684  Japan

fetch_events(exchange='kalshi', query='Trump') no longer raises.

Test plan

  • CI passes
  • After deploy, hosted MCP returns non-zero volume24h for active HL markets
  • Hosted MCP returns typed errors (not 500) when Kalshi or another venue is briefly unavailable

…alshi error class kwargs

Hyperliquid:
- fetchRawMarkets and fetchEventsImpl now pull dayNtlVlm per outcome leg
  from spotMetaAndAssetCtxs (one extra batched call) and sum Yes+No
  notional into volume24h. Previously hardcoded 0 across all HL markets
  and events.
- One bulk call, no N+1; falls back to 0 if spotMetaAndAssetCtxs is
  unreachable.

Python SDK:
- NetworkError and ExchangeNotAvailable rejected the code/retryable
  kwargs that from_server_error always sets. Any 503 from Kalshi or
  another venue raised TypeError instead of a typed PmxtError. Now both
  accept **kwargs and default-fill their hardcoded values.

Verified via Python SDK against local server:
  fetch_events(query='World Cup', exchange='hyperliquid'):
    $2,211,178  2026 World Cup Champion
    $  761,324  World Cup: Spain vs Saudi Arabia
    ...
  fetch_events(query='Trump', exchange='kalshi') no longer raises.
@realfishsam
realfishsam merged commit 05da32b into main Jun 21, 2026
6 of 11 checks passed
@realfishsam
realfishsam deleted the fix/hl-volume24h-and-kalshi-error branch June 21, 2026 15:50
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