Skip to content

feat(market-data): 24h volume endpoint for pair ranking#173

Draft
fengtality wants to merge 1 commit into
mainfrom
feat/market-data-volumes
Draft

feat(market-data): 24h volume endpoint for pair ranking#173
fengtality wants to merge 1 commit into
mainfrom
feat/market-data-volumes

Conversation

@fengtality

Copy link
Copy Markdown
Contributor

Summary

Adds GET /market-data/volumes/{connector} — 24h quote-denominated volume per trading pair, keyed by Hummingbot trading pair (BASE-QUOTE) so it joins cleanly with /connectors/{connector}/trading-rules.

Intended for ranking/curating a trade-pair selector. A value of 0.0 marks a listed-but-untraded market — e.g. Hyperliquid's permissionless tokenized-equity spot pairs like AAPL-USDC, which exist in spotMeta.universe but never trade (dayNtlVlm=0) — so a client can rank by volume and hide the zombies.

GET /market-data/volumes/hyperliquid
{"connector": "hyperliquid", "volumes": {"HYPE-USDC": 408658903.9, "UBTC-USDC": 96719815.0, "AAPL-USDC": 0.0, ...}}

How it works

Volumes are sourced from each exchange's public ticker endpoint (no creds) and mapped back to trading pairs via the connector's own symbol map (trading_pair_associated_to_exchange_symbol), so keys always match trading-rules. Cached 60s.

Connector Source Quote volume field
hyperliquid spotMetaAndAssetCtxs dayNtlVlm (keyed by ctx coin; ctxs are not index-aligned with universe)
hyperliquid_perpetual metaAndAssetCtxs × main dex + all HIP-3 dexes (perpDexs → per-dex call, gathered) dayNtlVlm
binance / binance_perpetual /ticker/24hr quoteVolume
okx / okx_perpetual /market/tickers volCcy24h (spot = quote ccy; swap = base ccy × last)

Unsupported connectors raise a clear 400. The structure is built to add more exchanges incrementally (one _fetch_* helper per family).

Notes

  • Volume is quote-denominated (truthful), so fiat-quoted pairs (USDT-IDR, USDT-TRY) carry large numeric volume — consumers should rank within a quote group, not across currencies.
  • Pairs with their data available as 0.0 are untraded; pairs absent from the map are unknown (e.g. a connector with HIP-3 disabled) and should not be hidden.

Pairs with

Test plan

Verified live across all six connectors against a running API:

  • hyperliquid → top HYPE/UBTC/UZEC/UETH/USOL, matching the Hyperliquid UI; AAPL-USDC = 0.0.
  • hyperliquid_perpetualBTC/HYPE/ETH/ZEC interleaved with HIP-3 XYZ:XYZ100, XYZ:SP500, XYZ:CL ($268M); 418 pairs.
  • binance/binance_perpetual/okx/okx_perpetual → sane top pairs.

🤖 Generated with Claude Code

Adds GET /market-data/volumes/{connector} returning 24h quote-denominated volume
per trading pair, keyed by Hummingbot trading pair (BASE-QUOTE) so it joins
cleanly with trading rules. A value of 0.0 marks a listed-but-untraded market —
e.g. Hyperliquid's permissionless tokenized-equity spot pairs like AAPL-USDC,
which exist in spotMeta.universe but never trade (dayNtlVlm=0) — so a client can
rank the pair selector by volume and hide the zombies.

Volumes are sourced per-exchange from public ticker endpoints and mapped back to
trading pairs via the connector's own symbol map (so keys always match
trading-rules), cached 60s:
- hyperliquid / hyperliquid_perpetual: spotMetaAndAssetCtxs / metaAndAssetCtxs
  dayNtlVlm (USDC notional)
- binance / binance_perpetual: /ticker/24hr quoteVolume
- okx / okx_perpetual: /market/tickers volCcy24h (spot is quote ccy; swap is base
  ccy, scaled by last price)

Unsupported connectors raise a clear 400. Verified live across all six.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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