OKX¶
Capabilities¶
Backfill: OHLC (full,
history-candles), trades (full,history-trades, paged backward by timestamp), order-book snapshot.Stream: OHLC, trades, order book.
OHLC fidelity:
quote_volume✅ native ·trades— null.
Symbols¶
BTC-USDT (dash), instId format.
Example¶
async with Client() as c:
await c.backfill("okx", "BTC/USDT", "trades", start="2024-01-01")
API¶
- class OKXSource(http=None)[source]¶
OKX source adapter.
Backfill: OHLC (full, via
history-candles), trades (full, viahistory-trades, paged backward by timestamp), order-book snapshot.Stream: OHLC, trades, order book.
See also
dccd.Clientthe public facade.
Examples
>>> from dccd.sources.okx import OKXSource >>> OKXSource().capability_for(DataType.TRADES, 'rest', 'historical').history 'full'
- 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 trades (cursor = OKX
afterts in ms).OKX
history-trades(type=2) returns records earlier than theaftertimestamp, newest first. We page backward fromend_nsuntil the oldest item drops belowstart_nsor a short page arrives.