Coinbase

Capabilities

  • Backfill: OHLC (300 candles/req, windowed automatically), order-book snapshot (level 2), trades (recent only).

  • Stream: trades.

  • OHLC fidelity: quote_volume — null · trades — null.

Note

Coinbase paginates trades through CB-AFTER response headers, which the JSON-only transport does not expose — a trades backfill returns a single recent page (declared history="recent"). Live OHLC / order book are not implemented and not declared.

Symbols

BTC-USD (dash). Coinbase quotes in USD, not USDT.

Example

async with Client() as c:
    await c.backfill("coinbase", "BTC/USD", "ohlc", span=3600, start="2024-01-01")

API

class CoinbaseSource(http=None)[source]

Coinbase source adapter.

  • Backfill: OHLC (full, 300 candles/req — windowed automatically), trades (recent only — see Notes), order-book snapshot (level 2).

  • Stream: trades only.

See also

dccd.Client

the public facade.

Notes

Coinbase paginates trades through CB-AFTER response headers, which the JSON-only transport does not expose, so trades backfill returns a single recent page (declared history="recent"). Live OHLC / order book are not implemented and are not declared as capabilities.

Examples

>>> from dccd.sources.coinbase import CoinbaseSource
>>> CoinbaseSource().capability_for(DataType.OHLC, 'rest', 'historical').max_per_request
300
capabilities()[source]

Declared capabilities, one per (data type × transport × mode).

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 the most recent trades (history="recent").

Coinbase Exchange paginates trades through CB-AFTER/CB-BEFORE response headers, which the current JSON-only transport does not expose. We therefore return a single recent page and never a cursor — deep history is genuinely unavailable here (declared via the history="recent" capability, enforced by the backfill engine).

render_symbol(s)[source]

Coinbase format: BTC-USD.

stream_ohlc(symbol, span)[source]

Stream live OHLC bars over WebSocket.

stream_orderbook(symbol, depth)[source]

Stream live order-book snapshots/deltas over WebSocket.

stream_trades(symbol)[source]

Stream live trades over WebSocket.