Kraken¶
Capabilities¶
Backfill: OHLC (720 recent bars only), trades (full,
sincecursor), order-book snapshot.Stream: OHLC, trades, order book (snapshot + deltas reconstructed locally).
OHLC fidelity:
quote_volume✅ (vwap × volume, exact) ·trades✅ native.
Note
Kraken’s OHLC REST returns only the 720 most recent bars
(history="recent"); a deeper backfill is clamped to that window with a
warning. Deep OHLC history would have to be derived from trades (deferred).
Symbols¶
XXBTZUSD — Kraken uses XBT for Bitcoin and prefixes fiat with Z.
dccd maps BTC/USD for you.
Example¶
async with Client() as c:
await c.backfill("kraken", "BTC/USD", "trades", start="2024-01-01") # full history
await c.backfill("kraken", "BTC/USD", "ohlc", span=3600, start="last") # 720 recent
API¶
- class KrakenSource(http=None)[source]¶
Kraken source adapter.
Backfill: OHLC (recent only — see Notes), trades (full,
sincecursor), order-book snapshot.Stream: OHLC, trades, order book (snapshot + deltas reconstructed).
See also
dccd.Clientthe public facade.
Notes
Kraken’s OHLC REST returns only the 720 most recent bars (
history="recent"); a deeper backfill is clamped to that window with a warning. Full deep OHLC would have to be derived from trades (deferred).Examples
>>> from dccd.sources.kraken import KrakenSource >>> KrakenSource().capability_for(DataType.OHLC, 'rest', 'historical').history 'recent'
- async fetch_ohlc_page(symbol, span, start_ns, end_ns, limit)[source]¶
Fetch up to limit OHLC bars from start_ns.
Warning
Kraken only returns the 720 most recent bars. Requests for deep history silently return recent data. Use the
history="recent"capability to inform the resolver.
- 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 trades (cursor = Kraken
sincens).Kraken returns up to 1 000 trades from the
sincecursor and aresult["last"]nanosecond cursor for the next page. We follow it until the page is short (caught up to the present) or the cursor stops advancing.