Add Ticker24h support: hourly market snapshots with USD-normalized volume filtering

This commit is contained in:
2026-04-26 18:39:52 -04:00
parent 85fcbe1330
commit 0178b5d29d
45 changed files with 1995 additions and 170 deletions

View File

@@ -77,6 +77,54 @@ print(df.head())
- `"ticker"` - Market identifier
- `"period_seconds"` - Period in seconds
## Building a Scanner Universe with get_ticker_24h
**Always pre-filter symbols before fetching OHLC for multiple tickers.** The per-script bar budget is 2M bars; fetching all ~1800 Binance symbols would exhaust it immediately. Use `get_ticker_24h` to get a ranked, filtered list of symbols with no OHLC budget cost, then run per-symbol analysis only on the filtered set.
```python
from dexorder.api import get_api
import asyncio
api = get_api()
# Get top 50 most liquid Binance spot symbols by USD volume (no bar budget used)
universe = asyncio.run(api.data.get_ticker_24h(
"BINANCE",
limit=50,
market_type="spot",
min_std_quote_volume=10_000_000 # filter to $10M+ daily USD volume
))
print(f"Universe: {len(universe)} symbols")
# Now fetch OHLC only for the filtered set
for ticker in universe["ticker"]:
df = asyncio.run(api.data.historical_ohlc(
ticker=ticker,
period_seconds=86400, # daily bars for a scanner
start_time="2024-01-01",
end_time="2025-01-01",
extra_columns=["volume"]
))
print(f"[Data] {ticker}: {len(df)} bars")
```
### Filter parameters
```python
# All BTC pairs on Binance
df = asyncio.run(api.data.get_ticker_24h("BINANCE", base_asset_contains="BTC"))
# Top 100 perp markets with $50M+ daily volume
df = asyncio.run(api.data.get_ticker_24h(
"BINANCE", limit=100, market_type="perp", min_std_quote_volume=50_000_000
))
# All symbols on Coinbase
df = asyncio.run(api.data.get_ticker_24h("COINBASE"))
```
Returned DataFrame is sorted by `std_quote_volume` (USD-normalized) descending. Symbols without a USD rate have `std_quote_volume = NaN` and appear last. Full column list: `ticker`, `exchange_id`, `base_asset`, `quote_asset`, `last_price`, `price_change_pct`, `quote_volume_24h`, `std_quote_volume`, `bid_price`, `ask_price`, `open_24h`, `high_24h`, `low_24h`, `volume_24h`, `num_trades`, `timestamp_ms`.
## Using the Charting API
The charting API provides styled financial charts with OHLC candlesticks and technical indicators.