dccd 2.0.2__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. dccd-2.2.0/CHANGELOG.md +140 -0
  2. {dccd-2.0.2 → dccd-2.2.0}/PKG-INFO +128 -23
  3. dccd-2.2.0/README.rst +227 -0
  4. {dccd-2.0.2 → dccd-2.2.0}/dccd/continuous_dl/__init__.py +13 -3
  5. dccd-2.2.0/dccd/continuous_dl/binance.py +250 -0
  6. {dccd-2.0.2 → dccd-2.2.0}/dccd/continuous_dl/bitfinex.py +74 -145
  7. dccd-2.2.0/dccd/continuous_dl/bitmex.py +350 -0
  8. {dccd-2.0.2 → dccd-2.2.0}/dccd/continuous_dl/bybit.py +46 -32
  9. dccd-2.2.0/dccd/continuous_dl/exchange.py +346 -0
  10. dccd-2.2.0/dccd/continuous_dl/kraken.py +323 -0
  11. dccd-2.2.0/dccd/continuous_dl/okx.py +317 -0
  12. dccd-2.2.0/dccd/daemon/__init__.py +36 -0
  13. dccd-2.2.0/dccd/daemon/cli.py +260 -0
  14. dccd-2.2.0/dccd/daemon/config.py +258 -0
  15. dccd-2.2.0/dccd/daemon/health.py +245 -0
  16. dccd-2.2.0/dccd/daemon/scheduler.py +153 -0
  17. dccd-2.2.0/dccd/daemon/storage.py +118 -0
  18. dccd-2.2.0/dccd/daemon/stream_manager.py +364 -0
  19. {dccd-2.0.2 → dccd-2.2.0}/dccd/histo_dl/binance.py +59 -7
  20. {dccd-2.0.2 → dccd-2.2.0}/dccd/histo_dl/bybit.py +63 -5
  21. {dccd-2.0.2 → dccd-2.2.0}/dccd/histo_dl/coinbase.py +72 -8
  22. dccd-2.2.0/dccd/histo_dl/exchange.py +666 -0
  23. dccd-2.2.0/dccd/histo_dl/kraken.py +214 -0
  24. {dccd-2.0.2 → dccd-2.2.0}/dccd/histo_dl/okx.py +56 -5
  25. {dccd-2.0.2 → dccd-2.2.0}/dccd/models.py +16 -11
  26. dccd-2.2.0/dccd/tests/conftest.py +222 -0
  27. dccd-2.2.0/dccd/tests/test_binance.py +84 -0
  28. dccd-2.2.0/dccd/tests/test_binance_ws.py +187 -0
  29. dccd-2.2.0/dccd/tests/test_bitfinex.py +83 -0
  30. dccd-2.2.0/dccd/tests/test_bitmex.py +108 -0
  31. dccd-2.2.0/dccd/tests/test_bybit.py +77 -0
  32. dccd-2.2.0/dccd/tests/test_bybit_ws.py +114 -0
  33. dccd-2.2.0/dccd/tests/test_coinbase.py +73 -0
  34. dccd-2.2.0/dccd/tests/test_daemon_cli.py +108 -0
  35. dccd-2.2.0/dccd/tests/test_daemon_config.py +175 -0
  36. dccd-2.2.0/dccd/tests/test_daemon_health.py +85 -0
  37. dccd-2.2.0/dccd/tests/test_daemon_scheduler.py +152 -0
  38. dccd-2.2.0/dccd/tests/test_daemon_storage.py +204 -0
  39. dccd-2.2.0/dccd/tests/test_daemon_stream_manager.py +368 -0
  40. dccd-2.2.0/dccd/tests/test_date_time.py +127 -0
  41. dccd-2.2.0/dccd/tests/test_histo_dl.py +60 -0
  42. dccd-2.2.0/dccd/tests/test_kraken.py +80 -0
  43. dccd-2.2.0/dccd/tests/test_kraken_ws.py +163 -0
  44. {dccd-2.0.2 → dccd-2.2.0}/dccd/tests/test_models.py +7 -1
  45. dccd-2.2.0/dccd/tests/test_okx.py +77 -0
  46. dccd-2.2.0/dccd/tests/test_okx_ws.py +152 -0
  47. dccd-2.2.0/dccd/tests/test_websocket.py +69 -0
  48. {dccd-2.0.2 → dccd-2.2.0}/dccd/tools/__init__.py +0 -2
  49. {dccd-2.0.2 → dccd-2.2.0}/dccd/tools/date_time.py +59 -30
  50. {dccd-2.0.2 → dccd-2.2.0}/dccd/tools/io.py +14 -11
  51. {dccd-2.0.2 → dccd-2.2.0}/dccd.egg-info/PKG-INFO +128 -23
  52. {dccd-2.0.2 → dccd-2.2.0}/dccd.egg-info/SOURCES.txt +25 -0
  53. dccd-2.2.0/dccd.egg-info/entry_points.txt +2 -0
  54. {dccd-2.0.2 → dccd-2.2.0}/dccd.egg-info/requires.txt +11 -0
  55. {dccd-2.0.2 → dccd-2.2.0}/pyproject.toml +11 -9
  56. dccd-2.0.2/CHANGELOG.md +0 -76
  57. dccd-2.0.2/README.rst +0 -132
  58. dccd-2.0.2/dccd/continuous_dl/bitmex.py +0 -386
  59. dccd-2.0.2/dccd/continuous_dl/exchange.py +0 -261
  60. dccd-2.0.2/dccd/histo_dl/exchange.py +0 -322
  61. dccd-2.0.2/dccd/histo_dl/kraken.py +0 -139
  62. dccd-2.0.2/dccd/tests/conftest.py +0 -95
  63. dccd-2.0.2/dccd/tests/test_binance.py +0 -32
  64. dccd-2.0.2/dccd/tests/test_bybit.py +0 -29
  65. dccd-2.0.2/dccd/tests/test_coinbase.py +0 -25
  66. dccd-2.0.2/dccd/tests/test_date_time.py +0 -46
  67. dccd-2.0.2/dccd/tests/test_kraken.py +0 -25
  68. dccd-2.0.2/dccd/tests/test_okx.py +0 -29
  69. {dccd-2.0.2 → dccd-2.2.0}/CONTRIBUTING.md +0 -0
  70. {dccd-2.0.2 → dccd-2.2.0}/LICENSE.txt +0 -0
  71. {dccd-2.0.2 → dccd-2.2.0}/MANIFEST.in +0 -0
  72. {dccd-2.0.2 → dccd-2.2.0}/dccd/__init__.py +0 -0
  73. {dccd-2.0.2 → dccd-2.2.0}/dccd/histo_dl/__init__.py +0 -0
  74. {dccd-2.0.2 → dccd-2.2.0}/dccd/process_data.py +0 -0
  75. {dccd-2.0.2 → dccd-2.2.0}/dccd/tests/__init__.py +0 -0
  76. {dccd-2.0.2 → dccd-2.2.0}/dccd/tests/test_io.py +0 -0
  77. {dccd-2.0.2 → dccd-2.2.0}/dccd/tests/test_process_data.py +0 -0
  78. {dccd-2.0.2 → dccd-2.2.0}/dccd/tools/websocket.py +0 -0
  79. {dccd-2.0.2 → dccd-2.2.0}/dccd.egg-info/dependency_links.txt +0 -0
  80. {dccd-2.0.2 → dccd-2.2.0}/dccd.egg-info/top_level.txt +0 -0
  81. {dccd-2.0.2 → dccd-2.2.0}/setup.cfg +0 -0
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [2.2.0] - 2026-05-17
10
+
11
+ ### Added
12
+
13
+ - `dccd/histo_dl/exchange.py` — `import_trades(start, end)` and `import_orderbook(depth)` public methods on `ImportDataCryptoCurrencies`; `_sort_trades` / `_sort_orderbook` helpers validate via Pydantic, sort and deduplicate; `trades_df` / `orderbook_df` attributes; `save_trades` / `save_orderbook` save helpers (#31)
14
+ - `dccd/histo_dl/{binance,kraken,bybit,okx,coinbase}.py` — `_import_trades(start, end)` and `_import_orderbook(depth)` implemented for all five exchanges; Binance and Kraken support full history via paginated endpoints; Bybit (≤ 1 000) and Coinbase (≤ 100) return recent-only snapshots (#31)
15
+ - `dccd/models.py` — `Trade.tid` made optional (`int | None`); `OrderBookEntry` gains required `side` field (`'bid'` or `'ask'`) and `count` made optional (`int | None`) (#31)
16
+ - `dccd/daemon/health.py` — `HealthMonitor`: rotating log handler (10 MB × 5 files), per-job metrics JSON, and optional Slack/Discord webhook alerts on consecutive failures; `JobMetrics` dataclass (#30)
17
+ - `dccd/daemon/cli.py` — `dccd` CLI (`validate`, `run`, `start`, `status`, `add` commands) via typer; `[project.scripts]` entrypoint; `typer>=0.12` added to the `daemon` extra (#30)
18
+ - `dccd/daemon/stream_manager.py` — `StreamManager` (one thread per `(exchange, pair)`, auto-restart on crash) and `SyncService` (periodic rclone push to all remotes, decoupled from collection) (#26)
19
+ - `dccd/daemon/config.py` — declarative YAML config with Pydantic v2: `CollectorConfig`, `HistoJob`, `StreamJob`, `StorageConfig`, `AlertConfig`, `RemoteConfig`, `load_config()` (#25)
20
+ - `dccd/daemon/storage.py` — `RemoteStorage.push()` via rclone; supports multiple remotes and root-path sync (#25, #26)
21
+ - `dccd/daemon/scheduler.py` — `build_histo_scheduler()` (APScheduler 3.x), `run_histo_job()`, `run_once()` (#25)
22
+ - `examples/config.example.yml` — annotated reference config for the daemon (#25)
23
+ - `examples/daemon_example.py` — programmatic daemon example in 6 steps (#30)
24
+ - `pyproject.toml` — `[daemon]` optional extra (`pyyaml`, `apscheduler`, `typer`) (#25, #30)
25
+
26
+ ### Changed
27
+
28
+ - `dccd/daemon/scheduler.py` — `run_histo_job`, `build_histo_scheduler`, `run_once` accept an optional `health: HealthMonitor` parameter (#30)
29
+ - `dccd/daemon/stream_manager.py` — `StreamManager.__init__` accepts optional `health: HealthMonitor`; `_run_forever` records success/failure on each iteration (#30)
30
+ - `dccd/daemon/config.py` — `StorageConfig.remote` replaced by `remotes: list[RemoteConfig]` and `sync_interval: int` (#26)
31
+ - `dccd/histo_dl/{binance,coinbase,bybit,okx,kraken}.py` — `format_pair(crypto, fiat)` extracted as a static method, independently testable (#29)
32
+ - `dccd/continuous_dl/exchange.py` — unified `__call__`, `_push_trades`, `_push_book_updates`, `_get_book_state`, `_restore_book_state` in base class; separate `set_trades_saver` / `set_book_saver`; crash-recovery checkpoint; `snapshot_ts` injected into every snapshot payload (#28, #29)
33
+
34
+ ## [2.1.0] - 2026-05-15
35
+
36
+ ### Added
37
+
38
+ - `dccd/tests/test_binance.py`, `test_kraken.py`, `test_bybit.py`, `test_okx.py`, `test_coinbase.py` — REST error-scenario tests: HTTP 500 and malformed response for every exchange (#22)
39
+ - `dccd/continuous_dl/binance.py` — `DownloadBinanceData` streaming trades and order book via Binance combined WebSocket streams (#20)
40
+ - `dccd/continuous_dl/kraken.py` — `DownloadKrakenData` streaming trades, order book, and OHLCV via Kraken WebSocket v2 (#20)
41
+ - `dccd/continuous_dl/okx.py` — `DownloadOKXData` streaming trades, order book, and candles via OKX WebSocket v5 (#20)
42
+ - `get_trades_*`, `get_orderbook_*`, `get_data_*` high-level helpers for Binance, Kraken, and OKX (#20)
43
+ - `dccd/tests/test_binance_ws.py`, `test_kraken_ws.py`, `test_okx_ws.py` — 34 new tests for the new WS modules (#20)
44
+ - `README.rst` and `doc/source/index.rst` — exchange support matrix table (REST/WS × data type) (#20)
45
+ - `dccd/tests/test_websocket.py`, `test_bitfinex.py`, `test_bitmex.py`, `test_bybit_ws.py` — tests for `continuous_dl` and `BasisWebSocket`; coverage lifted from excluded to 82% overall (#12)
46
+ - `dccd/tests/test_histo_dl.py` — tests for `_get_last_date` (xlsx, csv, parquet, empty directory) (#12)
47
+ - `pyproject.toml` — `pytest-asyncio>=0.23` added to dev dependencies (#12)
48
+
49
+ ### Fixed
50
+
51
+ - `dccd/tools/date_time.py` — `span_to_str` and `str_to_span` now cover all spans supported by the exchanges: 180 s (3 m), 900 s (15 m), 14400 s (4 h), 21600 s (6 h), 28800 s (8 h), 43200 s (12 h), 259200 s (3 d), 1296000 s (15 d), 2592000 s (1 M); previously any span outside the original 7 values returned `None` and silently broke the save path (#21)
52
+ - `dccd/histo_dl/kraken.py` — `import_data` now raises `UserWarning` when `end` is passed, as the Kraken OHLC API does not support a custom end date and silently ignored the parameter (#21)
53
+
54
+ ### Changed
55
+
56
+ - `dccd/continuous_dl/exchange.py` — `get_parser()` now raises `KeyError` on unknown key instead of falling back to the removed debug parser; `_loop()` awaits `is_connect` instead of `_data` (#22)
57
+ - `dccd/continuous_dl/bitmex.py`, `dccd/continuous_dl/bybit.py` — added numpydoc docstrings on `_parser_trades()` and `_parser_book()` (#22)
58
+ - `dccd/histo_dl/exchange.py` — `ImportDataCryptoCurrencies` docstring updated: `See Also` lists all five exchanges; `platform` parameter documents all supported values; fixed typos (#22)
59
+ - `dccd/histo_dl/exchange.py` — `ImportDataCryptoCurrencies` now inherits from `ABC` and `_import_data` is decorated with `@abstractmethod`, preventing accidental instantiation of the base class (#21)
60
+ - `dccd/histo_dl/binance.py`, `coinbase.py`, `bybit.py`, `okx.py`, `kraken.py` — added `from __future__ import annotations`, `from typing import Any`, and full type hints on `_import_data` and `import_data` signatures (#21)
61
+ - `dccd/histo_dl/exchange.py` — `_get_last_date` now reads `.csv` and `.parquet` files in addition to `.xlsx` instead of falling back to 2012-01-01 (#12)
62
+ - `dccd/histo_dl/exchange.py` — completed numpydoc docstrings for `_get_last_date`, `_set_by_period`, `_name_file`, `_excel_format`, `_sort_data`, `set_hierarchy` (#12)
63
+ - `dccd/tools/io.py` — documented `driver`, `username`, `password`, `host`, `port` parameters of `save_as_sql` (#12)
64
+ - `dccd/continuous_dl/exchange.py` — documented `time_step=None` tick-by-tick behaviour in `ContinuousDownloader` (#12)
65
+ - `dccd/continuous_dl/bitfinex.py` — resolved all inline TODOs, added full type annotations, removed dead `__main__` block (#12)
66
+ - `dccd/continuous_dl/bitmex.py` — resolved all inline TODOs, added full type annotations, fixed undefined `pair` variable in `get_data_bitmex`, removed dead `__main__` block (#12)
67
+ - `pyproject.toml` — removed `bitfinex` and `bitmex` from mypy `ignore_errors` override; lifted `continuous_dl/*` and `tools/websocket.py` from coverage omit (#12)
68
+
69
+ ### Removed
70
+
71
+ - `ContinuousDownloader._parser_debug()` — dead method, never called; `dccd/tools/__init__.py` commented-out imports removed (#22)
72
+
73
+ ## [2.0.2] - 2026-05-15
74
+
75
+ ### Changed
76
+
77
+ - `README.rst` — added PyPI status, docstring coverage, and downloads badges
78
+
79
+ ## [2.0.1] - 2026-05-14
80
+
81
+ ### Changed
82
+
83
+ - Docstrings `See Also` updated in `FromBinance`, `FromKraken`, `FromCoinbase` — replaced defunct `FromGDax`/`FromPoloniex` with `FromBybit`/`FromOKX`
84
+ - `doc/source/index.rst` — exchange lists updated (Bybit, OKX added); all exchange RST pages added to toctree (previously orphaned)
85
+ - `dccd/__init__.py` module docstring — exchange list updated
86
+ - `pyproject.toml` — added `Documentation` and `Changelog` project URLs
87
+ - `README.rst` — added exchange support table, output format section, multi-exchange Quick start examples
88
+ - `examples/historical_downloader.py` — rewritten with modern API (Binance + Parquet)
89
+
90
+ ## [2.0.0] - 2026-05-14
91
+
92
+ ### Added
93
+
94
+ - `pyproject.toml` (PEP 517/518) — replaces `setup.py` (#5)
95
+ - GitHub Actions CI (`.github/workflows/ci.yml`) — matrix Python 3.10/3.11/3.12/3.13, jobs `test` and `lint` (#5)
96
+ - `dccd/histo_dl/coinbase.py` — `FromCoinbase` class replacing the defunct GDAX module (#5)
97
+ - `.githooks/pre-push` — Git Flow enforcement (#5)
98
+ - `CONTRIBUTING.md` — development setup, Git Flow, commit conventions (#5)
99
+ - `CHANGELOG.md` (#5)
100
+ - `.pre-commit-config.yaml` — hooks `ruff` (lint + fix) et `ruff-format` (#7)
101
+ - `dccd/tests/test_date_time.py`, `test_io.py`, `test_process_data.py` — couverture ≥ 80 % (#8)
102
+ - `.github/workflows/badges.yml` — badge couverture docstrings via `interrogate` (#8)
103
+ - `dccd/histo_dl/bybit.py` — `FromBybit` : téléchargement historique Bybit v5 REST (#9)
104
+ - `dccd/continuous_dl/bybit.py` — `DownloadBybitData` : stream WebSocket Bybit v5 (#9)
105
+ - `dccd/histo_dl/okx.py` — `FromOKX` : téléchargement historique OKX v5 REST (#9)
106
+ - `dccd/models.py` — `OHLCBar`, `Trade`, `OrderBookEntry` : validation pydantic des réponses API (#9)
107
+ - `IODataBase.save_as_parquet` — format Parquet via pyarrow (optionnel `dccd[io]`) (#9)
108
+ - `IODataBase.save_as_polars` — format Polars, Parquet sous le capot (optionnel `dccd[io]`) (#9)
109
+ - `ImportDataCryptoCurrencies.get_data(format='polars')` — retourne un `pl.DataFrame` (#9)
110
+ - `dccd/tools/date_time.py`, `tools/io.py`, `histo_dl/exchange.py`, `continuous_dl/exchange.py`, `tools/websocket.py` — type hints complets (#10)
111
+ - `.github/workflows/release.yml` — publication automatique PyPI + GitHub Release sur tag `v*` via OIDC (#10)
112
+
113
+ ### Changed
114
+
115
+ - **Breaking:** minimum Python version is now 3.10 (dropped 3.5–3.9) (#5)
116
+ - **Breaking:** minimum dependency versions bumped — `pandas>=2.0`, `SQLAlchemy>=2.0`, `numpy>=1.26`, `requests>=2.28`, `websockets>=12.0`, `scipy>=1.10` (#5)
117
+ - Replaced `xlrd` + `xlsxwriter` with `openpyxl` for Excel I/O (#5)
118
+ - `dccd/histo_dl/exchange.py`: `df.append()` → `pd.concat()`, `ffill()`, `openpyxl` engine (#5)
119
+ - `dccd/tools/io.py`: `SQLAlchemy URL()` → `URL.create()`, `df.append()` → `pd.concat()` (#5)
120
+ - Version now managed via `importlib.metadata` (#5)
121
+ - `dccd/tools/websocket.py`: `asyncio.get_event_loop().run_until_complete()` → `asyncio.run()` (#7)
122
+ - `dccd/tests/conftest.py`: fixtures `tmp_data_path` + mocks HTTP — les tests ne font plus d'appels réseau (#7)
123
+ - `doc/source/conf.py` : thème scipy → furo, extensions modernisées (#8)
124
+ - `dccd/histo_dl/binance.py` : API v1 → v3 (#9)
125
+ - `dccd/histo_dl/exchange.py` : `_fetch()` avec retry tenacity sur HTTP 429 (#9)
126
+ - `dccd/tools/websocket.py` : reconnexion automatique avec `max_retries` et `retry_delay` (#9)
127
+ - `print()` remplacés par `logging` dans `exchange.py`, `binance.py`, `date_time.py` (#9)
128
+ - `pyproject.toml` : `mypy>=1.0` + `pandas-stubs>=2.0` dans `dev`, section `[tool.mypy]` (#10)
129
+ - `.github/workflows/ci.yml` : étape `mypy dccd/` ajoutée dans le job `lint` (#10)
130
+ - `dccd/tools/websocket.py` : arguments mutables `conn={}` / `subs={}` corrigés en `None` (#10)
131
+
132
+ ### Fixed
133
+
134
+ - `dccd/tools/io.py` : logique CSV inversée dans `save_as_csv` — le fichier existant était écrasé au lieu d'être appendé (#8)
135
+
136
+ ### Removed
137
+
138
+ - **Breaking:** `FromPoloniex` and `dccd/histo_dl/poloniex.py` — Poloniex exchange shut down in 2024 (#5)
139
+ - **Breaking:** `FromGDax` and `dccd/histo_dl/gdax.py` — GDAX API endpoint defunct; replaced by `FromCoinbase` (#5)
140
+ - `setup.py`, `tox.ini`, `requirements.txt`, `doc-requirements.txt`, `.travis.yml` (#5)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dccd
3
- Version: 2.0.2
3
+ Version: 2.2.0
4
4
  Summary: Download Crypto Currency Data from different exchanges.
5
5
  Author-email: Arthur Bernard <arthur.bernard.92@gmail.com>
6
6
  License: MIT
@@ -33,19 +33,29 @@ Requires-Dist: pydantic>=2.0
33
33
  Provides-Extra: io
34
34
  Requires-Dist: pyarrow>=13; extra == "io"
35
35
  Requires-Dist: polars>=0.20; extra == "io"
36
+ Provides-Extra: daemon
37
+ Requires-Dist: pyyaml>=6.0; extra == "daemon"
38
+ Requires-Dist: apscheduler<4,>=3.10; extra == "daemon"
39
+ Requires-Dist: typer>=0.12; extra == "daemon"
36
40
  Provides-Extra: dev
37
41
  Requires-Dist: pytest>=7.4; extra == "dev"
42
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
38
43
  Requires-Dist: pytest-cov>=4.1; extra == "dev"
39
44
  Requires-Dist: ruff>=0.4; extra == "dev"
40
45
  Requires-Dist: interrogate>=1.5; extra == "dev"
41
46
  Requires-Dist: mypy>=1.0; extra == "dev"
42
47
  Requires-Dist: pandas-stubs>=2.0; extra == "dev"
48
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
49
+ Requires-Dist: apscheduler<4,>=3.10; extra == "dev"
50
+ Requires-Dist: typer>=0.12; extra == "dev"
43
51
  Provides-Extra: doc
44
52
  Requires-Dist: sphinx>=7.0; extra == "doc"
45
53
  Requires-Dist: furo; extra == "doc"
46
54
  Requires-Dist: numpydoc; extra == "doc"
47
55
  Requires-Dist: sphinx-design; extra == "doc"
48
56
  Requires-Dist: sphinx-copybutton; extra == "doc"
57
+ Requires-Dist: pyyaml>=6.0; extra == "doc"
58
+ Requires-Dist: apscheduler<4,>=3.10; extra == "doc"
49
59
  Dynamic: license-file
50
60
 
51
61
  =============================
@@ -75,7 +85,11 @@ Download Crypto-Currency Data
75
85
  :target: https://download-crypto-currencies-data.readthedocs.io/en/latest/
76
86
  :alt: Documentation Status
77
87
 
78
- .. image:: https://raw.githubusercontent.com/ArthurBernard/Download_Crypto_Currencies_Data/master/interrogate_badge_output.svg
88
+ .. image:: https://codecov.io/gh/ArthurBernard/Download_Crypto_Currencies_Data/branch/master/graph/badge.svg
89
+ :target: https://codecov.io/gh/ArthurBernard/Download_Crypto_Currencies_Data
90
+ :alt: Coverage
91
+
92
+ .. image:: https://raw.githubusercontent.com/ArthurBernard/Download_Crypto_Currencies_Data/badges/interrogate_badge.svg
79
93
  :target: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data
80
94
  :alt: Docstring Coverage
81
95
 
@@ -98,6 +112,10 @@ With optional Parquet / Polars support::
98
112
 
99
113
  $ pip install "dccd[io]"
100
114
 
115
+ With autonomous daemon support (APScheduler + PyYAML)::
116
+
117
+ $ pip install "dccd[daemon]"
118
+
101
119
  From source::
102
120
 
103
121
  $ git clone https://github.com/ArthurBernard/Download_Crypto_Currencies_Data
@@ -107,23 +125,27 @@ From source::
107
125
  Supported exchanges
108
126
  ===================
109
127
 
110
- +------------------+------------+-----------------+
111
- | Exchange | Historical | Real-time |
112
- +==================+============+=================+
113
- | Binance | ✓ | |
114
- +------------------+------------+-----------------+
115
- | Coinbase | ✓ | |
116
- +------------------+------------+-----------------+
117
- | Kraken | ✓ | |
118
- +------------------+------------+-----------------+
119
- | Bybit | ✓ | ✓ |
120
- +------------------+------------+-----------------+
121
- | OKX | ✓ | |
122
- +------------------+------------+-----------------+
123
- | Bitfinex | | ✓ |
124
- +------------------+------------+-----------------+
125
- | Bitmex | | ✓ |
126
- +------------------+------------+-----------------+
128
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
129
+ | Exchange | REST OHLCV | REST Trades | REST Order Book | WS OHLCV | WS Trades | WS Order Book |
130
+ +==================+============+=============+=================+==========+===========+================+
131
+ | Binance | ✓ || ✓ | | ✓ | ✓ |
132
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
133
+ | Coinbase | ✓ | ✓† | ✓ | | | |
134
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
135
+ | Kraken | ✓ || ✓ | ✓ | ✓ | ✓ |
136
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
137
+ | Bybit | ✓ | ✓† | ✓ | | ✓ | ✓ |
138
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
139
+ | OKX | ✓ || ✓ | ✓ | ✓ | ✓ |
140
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
141
+ | Bitfinex | | | | ✓\* | | ✓ |
142
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
143
+ | Bitmex | | | | | | ✓ |
144
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
145
+
146
+ \* Bitfinex WS OHLCV is aggregated from the trades stream via ``get_ohlc_bitfinex``.
147
+
148
+ † Recent trades only (Bybit ≤ 1 000, Coinbase ≤ 100) — no deep historical pagination via the public REST API.
127
149
 
128
150
  Presentation
129
151
  ============
@@ -137,6 +159,14 @@ Presentation
137
159
  Stream real-time data (order book, trades) via WebSocket with automatic
138
160
  reconnection and configurable processing/saving callbacks.
139
161
 
162
+ **Daemon** ``dccd.daemon``
163
+ Autonomous, server-side collector driven by a YAML config. Runs REST
164
+ jobs on a schedule (APScheduler), opens WebSocket streams for real-time
165
+ collection, and periodically syncs all local data to one or more remote
166
+ destinations (NAS, S3, SFTP, …) via rclone. Multiple remotes and a
167
+ configurable sync interval are supported; collection is never blocked by
168
+ remote availability.
169
+
140
170
  Output formats
141
171
  --------------
142
172
 
@@ -148,7 +178,9 @@ Parquet files can be read back as either a ``pandas.DataFrame`` or a
148
178
  Quick start
149
179
  ===========
150
180
 
151
- Historical data (pandas)::
181
+ Historical data (pandas):
182
+
183
+ .. code-block:: python
152
184
 
153
185
  from dccd.histo_dl import FromBinance
154
186
 
@@ -157,15 +189,21 @@ Historical data (pandas)::
157
189
  obj.save(form='parquet')
158
190
  df = obj.get_data() # pandas DataFrame
159
191
 
160
- Polars output::
192
+ Polars output:
193
+
194
+ .. code-block:: python
161
195
 
162
196
  df_pl = obj.get_data(format='polars')
163
197
 
164
- Incremental update (resume from last saved point)::
198
+ Incremental update (resume from last saved point):
199
+
200
+ .. code-block:: python
165
201
 
166
202
  obj.import_data(start='last', end='now').save(form='parquet')
167
203
 
168
- Other exchanges::
204
+ Other exchanges:
205
+
206
+ .. code-block:: python
169
207
 
170
208
  from dccd.histo_dl import FromKraken, FromBybit, FromOKX
171
209
 
@@ -173,6 +211,73 @@ Other exchanges::
173
211
  FromBybit('/path/', 'BTC', 86400).import_data(start='2024-01-01', end='now').save()
174
212
  FromOKX('/path/', 'BTC', 3600).import_data(start='2024-01-01', end='now').save()
175
213
 
214
+ Trades (historical or recent):
215
+
216
+ .. code-block:: python
217
+
218
+ from dccd.histo_dl import FromBinance, FromKraken
219
+
220
+ obj = FromBinance('/path/', 'BTC', 3600, fiat='USDT')
221
+ obj.import_trades(start='2024-01-01 00:00:00', end='2024-01-02 00:00:00')
222
+ obj.save_trades(form='csv')
223
+ df = obj.trades_df # pandas DataFrame — columns: timestamp, price, amount, type, tid
224
+
225
+ # Kraken also supports full history; Bybit/Coinbase return recent-only snapshots
226
+ FromKraken('/path/', 'BTC', 3600).import_trades(start='2024-01-01', end='2024-01-02').save_trades()
227
+
228
+ Order book snapshot:
229
+
230
+ .. code-block:: python
231
+
232
+ from dccd.histo_dl import FromOKX
233
+
234
+ obj = FromOKX('/path/', 'BTC', 3600)
235
+ obj.import_orderbook(depth=50)
236
+ obj.save_orderbook(form='csv')
237
+ df = obj.orderbook_df # columns: side, price, amount, count
238
+
239
+ Daemon (autonomous collector) — ``config.yml``:
240
+
241
+ .. code-block:: yaml
242
+
243
+ storage:
244
+ local_path: /data/crypto/
245
+ remotes:
246
+ - provider: rclone
247
+ remote: "mynas:crypto/"
248
+ sync_interval: 3600
249
+
250
+ histo_jobs:
251
+ - exchange: binance
252
+ pairs: [BTC/USDT, ETH/USDT]
253
+ span: 3600
254
+ format: parquet
255
+ by_period: Y
256
+
257
+ stream_jobs:
258
+ - exchange: binance
259
+ pairs: [BTC/USDT]
260
+ channels: [trades, book]
261
+ time_step: 60
262
+
263
+ .. code-block:: python
264
+
265
+ from dccd.daemon.config import load_config
266
+ from dccd.daemon.scheduler import run_once, build_histo_scheduler
267
+ from dccd.daemon.stream_manager import StreamManager
268
+
269
+ config = load_config('config.yml')
270
+
271
+ # One-shot: download all histo jobs once, then exit
272
+ run_once(config)
273
+
274
+ # Daemon mode: periodic REST + live WebSocket streams
275
+ scheduler = build_histo_scheduler(config)
276
+ scheduler.start()
277
+
278
+ mgr = StreamManager(config)
279
+ mgr.start() # runs until mgr.stop() is called
280
+
176
281
  Links
177
282
  =====
178
283
 
dccd-2.2.0/README.rst ADDED
@@ -0,0 +1,227 @@
1
+ =============================
2
+ Download Crypto-Currency Data
3
+ =============================
4
+
5
+ .. image:: https://img.shields.io/pypi/pyversions/dccd
6
+ :alt: PyPI - Python Version
7
+
8
+ .. image:: https://img.shields.io/pypi/v/dccd.svg
9
+ :target: https://pypi.org/project/dccd/
10
+ :alt: PyPI
11
+
12
+ .. image:: https://img.shields.io/pypi/status/dccd.svg?colorB=blue
13
+ :target: https://pypi.org/project/dccd/
14
+ :alt: PyPI - Status
15
+
16
+ .. image:: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data/actions/workflows/ci.yml/badge.svg
17
+ :target: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data/actions/workflows/ci.yml
18
+ :alt: CI
19
+
20
+ .. image:: https://img.shields.io/github/license/ArthurBernard/Download_Crypto_Currencies_Data.svg
21
+ :target: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data/blob/master/LICENSE.txt
22
+ :alt: License
23
+
24
+ .. image:: https://readthedocs.org/projects/download-crypto-currencies-data/badge/?version=latest
25
+ :target: https://download-crypto-currencies-data.readthedocs.io/en/latest/
26
+ :alt: Documentation Status
27
+
28
+ .. image:: https://codecov.io/gh/ArthurBernard/Download_Crypto_Currencies_Data/branch/master/graph/badge.svg
29
+ :target: https://codecov.io/gh/ArthurBernard/Download_Crypto_Currencies_Data
30
+ :alt: Coverage
31
+
32
+ .. image:: https://raw.githubusercontent.com/ArthurBernard/Download_Crypto_Currencies_Data/badges/interrogate_badge.svg
33
+ :target: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data
34
+ :alt: Docstring Coverage
35
+
36
+ .. image:: https://pepy.tech/badge/dccd
37
+ :target: https://pepy.tech/project/dccd
38
+ :alt: Downloads
39
+
40
+ Python package to download crypto-currency data (OHLCV, trades, order book) from multiple
41
+ exchanges via REST and WebSocket APIs. Data can be saved to CSV, Excel, SQLite, PostgreSQL,
42
+ or Parquet.
43
+
44
+ Installation
45
+ ============
46
+
47
+ From pip::
48
+
49
+ $ pip install dccd
50
+
51
+ With optional Parquet / Polars support::
52
+
53
+ $ pip install "dccd[io]"
54
+
55
+ With autonomous daemon support (APScheduler + PyYAML)::
56
+
57
+ $ pip install "dccd[daemon]"
58
+
59
+ From source::
60
+
61
+ $ git clone https://github.com/ArthurBernard/Download_Crypto_Currencies_Data
62
+ $ cd Download_Crypto_Currencies_Data
63
+ $ pip install -e .
64
+
65
+ Supported exchanges
66
+ ===================
67
+
68
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
69
+ | Exchange | REST OHLCV | REST Trades | REST Order Book | WS OHLCV | WS Trades | WS Order Book |
70
+ +==================+============+=============+=================+==========+===========+================+
71
+ | Binance | ✓ | ✓ | ✓ | | ✓ | ✓ |
72
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
73
+ | Coinbase | ✓ | ✓† | ✓ | | | |
74
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
75
+ | Kraken | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
76
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
77
+ | Bybit | ✓ | ✓† | ✓ | | ✓ | ✓ |
78
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
79
+ | OKX | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
80
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
81
+ | Bitfinex | | | | ✓\* | ✓ | ✓ |
82
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
83
+ | Bitmex | | | | | ✓ | ✓ |
84
+ +------------------+------------+-------------+-----------------+----------+-----------+----------------+
85
+
86
+ \* Bitfinex WS OHLCV is aggregated from the trades stream via ``get_ohlc_bitfinex``.
87
+
88
+ † Recent trades only (Bybit ≤ 1 000, Coinbase ≤ 100) — no deep historical pagination via the public REST API.
89
+
90
+ Presentation
91
+ ============
92
+
93
+ **Historical Downloader** ``dccd.histo_dl``
94
+ Download OHLCV data via REST APIs and save to disk. Supports chunked
95
+ requests, automatic retry on rate-limit (HTTP 429), and incremental
96
+ updates from the last saved timestamp.
97
+
98
+ **Continuous Downloader** ``dccd.continuous_dl``
99
+ Stream real-time data (order book, trades) via WebSocket with automatic
100
+ reconnection and configurable processing/saving callbacks.
101
+
102
+ **Daemon** ``dccd.daemon``
103
+ Autonomous, server-side collector driven by a YAML config. Runs REST
104
+ jobs on a schedule (APScheduler), opens WebSocket streams for real-time
105
+ collection, and periodically syncs all local data to one or more remote
106
+ destinations (NAS, S3, SFTP, …) via rclone. Multiple remotes and a
107
+ configurable sync interval are supported; collection is never blocked by
108
+ remote availability.
109
+
110
+ Output formats
111
+ --------------
112
+
113
+ Historical data can be saved as **CSV**, **Excel** (``.xlsx``), **SQLite**,
114
+ **PostgreSQL** (via SQLAlchemy), or **Parquet** (requires ``dccd[io]``).
115
+ Parquet files can be read back as either a ``pandas.DataFrame`` or a
116
+ ``polars.DataFrame``.
117
+
118
+ Quick start
119
+ ===========
120
+
121
+ Historical data (pandas):
122
+
123
+ .. code-block:: python
124
+
125
+ from dccd.histo_dl import FromBinance
126
+
127
+ obj = FromBinance('/path/to/data/', 'BTC', 3600, fiat='USDT')
128
+ obj.import_data(start='2024-01-01 00:00:00', end='2024-12-31 00:00:00')
129
+ obj.save(form='parquet')
130
+ df = obj.get_data() # pandas DataFrame
131
+
132
+ Polars output:
133
+
134
+ .. code-block:: python
135
+
136
+ df_pl = obj.get_data(format='polars')
137
+
138
+ Incremental update (resume from last saved point):
139
+
140
+ .. code-block:: python
141
+
142
+ obj.import_data(start='last', end='now').save(form='parquet')
143
+
144
+ Other exchanges:
145
+
146
+ .. code-block:: python
147
+
148
+ from dccd.histo_dl import FromKraken, FromBybit, FromOKX
149
+
150
+ FromKraken('/path/', 'ETH', 3600).import_data(start='2024-01-01', end='now').save()
151
+ FromBybit('/path/', 'BTC', 86400).import_data(start='2024-01-01', end='now').save()
152
+ FromOKX('/path/', 'BTC', 3600).import_data(start='2024-01-01', end='now').save()
153
+
154
+ Trades (historical or recent):
155
+
156
+ .. code-block:: python
157
+
158
+ from dccd.histo_dl import FromBinance, FromKraken
159
+
160
+ obj = FromBinance('/path/', 'BTC', 3600, fiat='USDT')
161
+ obj.import_trades(start='2024-01-01 00:00:00', end='2024-01-02 00:00:00')
162
+ obj.save_trades(form='csv')
163
+ df = obj.trades_df # pandas DataFrame — columns: timestamp, price, amount, type, tid
164
+
165
+ # Kraken also supports full history; Bybit/Coinbase return recent-only snapshots
166
+ FromKraken('/path/', 'BTC', 3600).import_trades(start='2024-01-01', end='2024-01-02').save_trades()
167
+
168
+ Order book snapshot:
169
+
170
+ .. code-block:: python
171
+
172
+ from dccd.histo_dl import FromOKX
173
+
174
+ obj = FromOKX('/path/', 'BTC', 3600)
175
+ obj.import_orderbook(depth=50)
176
+ obj.save_orderbook(form='csv')
177
+ df = obj.orderbook_df # columns: side, price, amount, count
178
+
179
+ Daemon (autonomous collector) — ``config.yml``:
180
+
181
+ .. code-block:: yaml
182
+
183
+ storage:
184
+ local_path: /data/crypto/
185
+ remotes:
186
+ - provider: rclone
187
+ remote: "mynas:crypto/"
188
+ sync_interval: 3600
189
+
190
+ histo_jobs:
191
+ - exchange: binance
192
+ pairs: [BTC/USDT, ETH/USDT]
193
+ span: 3600
194
+ format: parquet
195
+ by_period: Y
196
+
197
+ stream_jobs:
198
+ - exchange: binance
199
+ pairs: [BTC/USDT]
200
+ channels: [trades, book]
201
+ time_step: 60
202
+
203
+ .. code-block:: python
204
+
205
+ from dccd.daemon.config import load_config
206
+ from dccd.daemon.scheduler import run_once, build_histo_scheduler
207
+ from dccd.daemon.stream_manager import StreamManager
208
+
209
+ config = load_config('config.yml')
210
+
211
+ # One-shot: download all histo jobs once, then exit
212
+ run_once(config)
213
+
214
+ # Daemon mode: periodic REST + live WebSocket streams
215
+ scheduler = build_histo_scheduler(config)
216
+ scheduler.start()
217
+
218
+ mgr = StreamManager(config)
219
+ mgr.start() # runs until mgr.stop() is called
220
+
221
+ Links
222
+ =====
223
+
224
+ - PyPI: https://pypi.org/project/dccd/
225
+ - Documentation: https://download-crypto-currencies-data.readthedocs.io/
226
+ - Source: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data
227
+ - Changelog: https://github.com/ArthurBernard/Download_Crypto_Currencies_Data/blob/master/CHANGELOG.md
@@ -9,8 +9,8 @@
9
9
  """ Module to download continuously data.
10
10
 
11
11
  Module to download continuously data (orderbook, trades, etc.) and update
12
- automatically the database. *Currently only supports Bitfinex and Bitmex
13
- exchanges.*
12
+ automatically the database. Supports Binance, Bitfinex, Bitmex, Bybit,
13
+ Kraken, and OKX exchanges via WebSocket.
14
14
 
15
15
  .. currentmodule:: dccd.continuous_dl
16
16
 
@@ -18,8 +18,12 @@ exchanges.*
18
18
  :maxdepth: 1
19
19
  :caption: Contents:
20
20
 
21
+ continuous_dl.binance
21
22
  continuous_dl.bitfinex
22
23
  continuous_dl.bitmex
24
+ continuous_dl.bybit
25
+ continuous_dl.kraken
26
+ continuous_dl.okx
23
27
 
24
28
  """
25
29
 
@@ -28,12 +32,18 @@ exchanges.*
28
32
  # Third party packages
29
33
 
30
34
  # Local packages
31
- from . import bitfinex, bitmex, bybit, exchange
35
+ from . import binance, bitfinex, bitmex, bybit, exchange, kraken, okx
36
+ from .binance import *
32
37
  from .bitfinex import *
33
38
  from .bitmex import *
34
39
  from .bybit import *
40
+ from .kraken import *
41
+ from .okx import *
35
42
 
36
43
  __all__ = ['exchange']
44
+ __all__ += binance.__all__
37
45
  __all__ += bitfinex.__all__
38
46
  __all__ += bitmex.__all__
39
47
  __all__ += bybit.__all__
48
+ __all__ += kraken.__all__
49
+ __all__ += okx.__all__