Binance¶
The reference adapter — full historical depth and every live channel.
Capabilities¶
Backfill: OHLC (
klines, 1 000/req), trades (aggTrades, cursor-paginated byfromId), order-book snapshot (depth, ≤ 5 000).Stream: OHLC (
kline), trades (aggTrade), order book (depth).OHLC fidelity:
quote_volume✅ native ·trades✅ native.
Symbols¶
BTCUSDT (no separator) — pass BTC/USDT to dccd.
Example¶
async with Client() as c:
await c.backfill("binance", "BTC/USDT", "ohlc", span=3600, start="2024-01-01")
await c.backfill("binance", "BTC/USDT", "trades", start="2024-01-01")
API¶
- class BinanceSource(http=None)[source]¶
Binance source adapter (spot).
The reference adapter — full historical depth and every live channel.
Backfill: OHLC (
klines, 1 000/req), trades (aggTrades, cursor-paginated byfromId), order-book snapshot (depth, ≤ 5 000).Stream: OHLC (
kline), trades (aggTrade), order book (depth).
Adapters are not used directly — they are resolved by the engine from the registry. Drive them through
dccd.Clientor the CLI.See also
dccd.Clientthe public facade.
dccd.sources.registry.SourceRegistryadapter resolution.
Examples
>>> from dccd.sources.binance import BinanceSource >>> sorted({c.data_type.value for c in BinanceSource().capabilities()}) ['ohlc', 'orderbook', 'trades']
- async fetch_ohlc_page(symbol, span, start_ns, end_ns, limit)[source]¶
Fetch one page of OHLC bars (see
fetch_ohlc_page).
- async fetch_orderbook(symbol, depth)[source]¶
Fetch a current order-book snapshot up to depth levels.
- async fetch_trades_page(symbol, start_ns, end_ns, limit, cursor=None)[source]¶
Fetch one page of aggregate trades (cursor =
fromId).First call (
cursor=None) is time-bounded onstart_ns; subsequent calls follow thefromIdcursor. The next cursor is the last aggregate-trade id + 1, returned only while the page is full and the last trade is still inside the window.