KrakenSourceΒΆ

Defined in dccd.sources.kraken

class KrakenSource(http=None)[source]

Bases: OHLCHistory, TradesHistory, OrderBookSnapshotREST, OHLCLive, TradesLive, OrderBookLive

Kraken source adapter.

OHLC REST: most recent 720 bars only (history="recent"). Full OHLC history requires derivation from Trades (deferred, M3). Trades REST: full history via since cursor.

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_trades_page(symbol, start_ns, end_ns, limit, cursor=None)[source]

Fetch one page of trades (cursor = Kraken since ns).

Kraken returns up to 1 000 trades from the since cursor and a result["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.