feat(market-data): 24h volume endpoint for pair ranking#173
Draft
fengtality wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.0marks a listed-but-untraded market — e.g. Hyperliquid's permissionless tokenized-equity spot pairs likeAAPL-USDC, which exist inspotMeta.universebut 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.hyperliquidspotMetaAndAssetCtxsdayNtlVlm(keyed by ctxcoin; ctxs are not index-aligned withuniverse)hyperliquid_perpetualmetaAndAssetCtxs× main dex + all HIP-3 dexes (perpDexs→ per-dexcall, gathered)dayNtlVlmbinance/binance_perpetual/ticker/24hrquoteVolumeokx/okx_perpetual/market/tickersvolCcy24h(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
USDT-IDR,USDT-TRY) carry large numeric volume — consumers should rank within a quote group, not across currencies.0.0are untraded; pairs absent from the map are unknown (e.g. a connector with HIP-3 disabled) and should not be hidden.Pairs with
market_data.get_24h_volumes).Test plan
Verified live across all six connectors against a running API:
hyperliquid→ topHYPE/UBTC/UZEC/UETH/USOL, matching the Hyperliquid UI;AAPL-USDC = 0.0.hyperliquid_perpetual→BTC/HYPE/ETH/ZECinterleaved with HIP-3XYZ:XYZ100,XYZ:SP500,XYZ:CL($268M); 418 pairs.binance/binance_perpetual/okx/okx_perpetual→ sane top pairs.🤖 Generated with Claude Code