Skip to main content

Download Crypto Currency Data — hexagonal architecture, async-first.

Project description

dccd logo

Download Crypto-Currency Data — v3

Python versions PyPI CI License
Documentation Coverage


dccd downloads crypto-currency market data (OHLCV, trades, order book) from 7 exchanges via REST and WebSocket. Data is stored as Parquet files with nanosecond-precision timestamps.

Architecture (v3)

Hexagonal architecture — business logic is fully separated from interfaces:

Interfaces: CLI · HTTP API · Web UI · Python Client
                        ↓
          Application: backfill, stream, read, inventory
                        ↓
  Domain ← Sources (7 exchange adapters) ← Transport (httpx · WS · Paginator)
                        ↓
             Storage: ParquetStore + RunsStore (SQLite)
  • Async-first — httpx + websockets, one event loop; CLI via asyncio.run
  • Nanosecond timestamps — uniform int64 UTC throughout the store
  • Generic Paginator — no per-exchange chunking; Coinbase 300-limit is a capability declaration
  • NoCapability early — Bybit no spot trades history, Kraken OHLC recent-only → clear error
  • Four iso-functional interfaces — same operations everywhere (parity test enforces this)

Supported exchanges

You pick a data type (OHLC · trades · order book) and an operationbackfill (history) or stream (live):

Exchange Backfill (history) Stream (live)
Binance OHLC · trades · book OHLC · trades · book
Coinbase OHLC · book · trades (recent) trades
Kraken OHLC (720 recent) · trades · book OHLC · trades · book
Bybit OHLC · book OHLC · trades · book
OKX OHLC · trades · book OHLC · trades · book
Bitfinex OHLC · trades · book OHLC · trades
BitMEX OHLC (1m/5m/1h/1d) · trades · book OHLC · trades · book

Trades backfill is cursor-paginated (drains the full window, not just the first page). recent = no deep history via the public API (a deeper request is rejected/clamped early, never silently truncated); Bybit spot has no trade history. Order-book backfill is a single snapshot — use a stream to record the book over time. Stream channels are only listed where really implemented (undeclared ones raise NoCapability).

OHLC field fidelity

Not every exchange returns every OHLC field natively. Missing fields are stored as null (never fabricated):

Exchange quote_volume trades (count)
Binance ✅ native ✅ native
Bybit / OKX ✅ native — null
Kraken ✅ (vwap × volume, exact) ✅ native
Coinbase / Bitfinex / BitMEX — null — null

Installation

# Core — Python 3.11+
pip install dccd

# With scheduler, CLI, and web UI
pip install "dccd[daemon]"

# Development
pip install "dccd[dev]"

Quick start

Python API

import asyncio
from dccd import Client

async def main():
    async with Client() as c:
        result = await c.backfill("binance", "BTC/USDT", data_type="ohlc", span=3600)
        print(f"Wrote {result['rows_written']} rows")
        for ds in c.inventory():
            print(ds)

asyncio.run(main())

CLI

dccd validate --config config.yml      # validate config
dccd backfill --config config.yml      # run all backfill jobs
dccd backfill -e binance -s BTC/USDT --type ohlc --span 3600  # ad-hoc
dccd stream   --config config.yml      # run WebSocket stream jobs
dccd start    --config config.yml      # full daemon + UI
dccd ui       --config config.yml      # UI only (no scheduler)
dccd inventory --config config.yml     # list stored datasets
dccd status   --config config.yml      # show recent runs

Configuration (config.yml)

settings:
  data_path: ./data/crypto
  timezone: UTC
  ui_port: 8080

jobs:
  - exchange: binance
    pairs: [BTC/USDT, ETH/USDT]
    data_type: ohlc
    span: 3600
    trigger_kind: interval
    every: 3600

  - exchange: kraken
    pairs: [BTC/USD]
    data_type: trades
    operation: stream
    trigger_kind: supervised

storage:
  remotes:
    - provider: rclone
      remote: "mynas:crypto/"
  sync_interval: 3600

HTTP API (when dccd ui or dccd start is running)

GET  /api/operations          list registered operations
POST /api/backfill            start a backfill job
GET  /api/backfill/{run_id}   poll run status
GET  /api/streams             list stream jobs + state
POST /api/streams/start       start a stream job
POST /api/streams/stop        stop a stream job
POST /api/read                read stored data (≤1 000 rows)
GET  /api/events              SSE stream of progress/log/status events
GET  /api/inventory           list all datasets
GET  /health                  liveness check

Data layout

{data_path}/
  {exchange}/
    ohlc/{pair}/{span}/YYYY.parquet       # annual, ns timestamps
    trades/{pair}/YYYY-MM-DD.parquet      # daily
    orderbook/{pair}/YYYY-MM-DD.parquet   # daily
    .dccd/runs.db                         # SQLite job run history

All timestamps are nanoseconds UTC (int64).

Development

pip install -e ".[dev]"
pytest             # 141 tests
ruff check dccd/   # lint
mypy dccd/         # type check (strict on domain/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dccd-3.1.0.tar.gz (138.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dccd-3.1.0-py3-none-any.whl (156.4 kB view details)

Uploaded Python 3

File details

Details for the file dccd-3.1.0.tar.gz.

File metadata

  • Download URL: dccd-3.1.0.tar.gz
  • Upload date:
  • Size: 138.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dccd-3.1.0.tar.gz
Algorithm Hash digest
SHA256 f3cfeb6e164c6a3c9e461d686998ab7489422c539270b40ca5d6ec0ceae8be73
MD5 2625aa5f0b6ea9f49c38c4baf9232d0d
BLAKE2b-256 123d648644fe1ba1eb871bed399c8f4caea226ceed89eb615aefe13e41dc091b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dccd-3.1.0.tar.gz:

Publisher: release.yml on ArthurBernard/Download_Crypto_Currencies_Data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dccd-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: dccd-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 156.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dccd-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf3cd0680e516e0135b32458e9f54148847e9c8f1dcb7670be51ea6095f92663
MD5 bfbaa9ac2e6049f060496ba7eb1606e1
BLAKE2b-256 334a9c0fdb9935ed79184e85e5e0f6b0124ce734086e846ac3c6c8e744de4c93

See more details on using hashes here.

Provenance

The following attestation bundles were made for dccd-3.1.0-py3-none-any.whl:

Publisher: release.yml on ArthurBernard/Download_Crypto_Currencies_Data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page