crypto-data-downloader


Namecrypto-data-downloader JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/SerenaTradingResearch/crypto-data-downloader
SummaryHigh-speed cryptocurrency OHLCV data downloader via concurrent API requests
upload_time2025-08-05 06:43:50
maintainerNone
docs_urlNone
authorRicky Ding
requires_python>=3.8
licenseMIT
keywords crypto binance ohlcv market-data downloader
VCS
bugtrack_url
requirements matplotlib numpy aiohttp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
## Intro

- Downloads crypto kline (candlestick) data **fast** by making as many concurrent API requests as possible
    - Takes `3 minutes` to download `1 month` of entire market data (`597 symbols`), with `5 minutes` time interval

![](https://raw.githubusercontent.com/SerenaTradingResearch/crypto-data-downloader/main/test/data/crypto_data_2025-07-01_2025-08-01.pkl.png)

## Usage

```bash
pip install crypto-data-downloader
```

```py
import asyncio

from crypto_data_downloader.binance import ALL_COLUMNS, CryptoDataDownloader
from crypto_data_downloader.utils import load_pkl, plot_crypto_data

# Refer to https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data


x = CryptoDataDownloader()
x.weight_lim = 5000  # Binance request weight limit per minute, max: 6000
x.quote = "USDT"  # Quote asset
x.interval = "5m"  # Kline time interval
x.kline_lim = 1000  # Kline number of data points per request
x.columns = ["open_time", "close"]  # Data columns to include
print(f"All data columns: {ALL_COLUMNS}")
asyncio.run(x.download("2025-07-01", "2025-08-01"))  # Time in UTC

path = "data/crypto_data_2025-07-01_2025-08-01.pkl"
data = load_pkl(path, gz=True)
plot_crypto_data(data, path)
```

- Output

```bash
All data columns: ['open_time', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_volume', 'n_trades', 'taker_buy_base_volume', 'taker_buy_quote_volume', 'unused']
weight lim: 5000/6000, USDT symbols: 597, spot: 557, margin: 401
9 intervals * 597 symbols = 5373 requests -> 2.1492 minutes
left: 5373/5373
server time: 1754371957632, my time: 1754371957664, diff: -32 ms, weight used: 21
left: 2884/5373
server time: 1754372028132, my time: 1754372028165, diff: -33 ms, weight used: 1
left: 385/5373
server time: 1754372095736, my time: 1754372095764, diff: -28 ms, weight used: 1
left: 0/5373
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SerenaTradingResearch/crypto-data-downloader",
    "name": "crypto-data-downloader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "crypto, binance, ohlcv, market-data, downloader",
    "author": "Ricky Ding",
    "author_email": "e0134117@u.nus.edu",
    "download_url": "https://files.pythonhosted.org/packages/e4/74/c4f8c48d2c7d3865ff07d6237c6207da760bd80c0aae5c75a8615801a07e/crypto_data_downloader-0.1.2.tar.gz",
    "platform": null,
    "description": "\n## Intro\n\n- Downloads crypto kline (candlestick) data **fast** by making as many concurrent API requests as possible\n    - Takes `3 minutes` to download `1 month` of entire market data (`597 symbols`), with `5 minutes` time interval\n\n![](https://raw.githubusercontent.com/SerenaTradingResearch/crypto-data-downloader/main/test/data/crypto_data_2025-07-01_2025-08-01.pkl.png)\n\n## Usage\n\n```bash\npip install crypto-data-downloader\n```\n\n```py\nimport asyncio\n\nfrom crypto_data_downloader.binance import ALL_COLUMNS, CryptoDataDownloader\nfrom crypto_data_downloader.utils import load_pkl, plot_crypto_data\n\n# Refer to https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data\n\n\nx = CryptoDataDownloader()\nx.weight_lim = 5000  # Binance request weight limit per minute, max: 6000\nx.quote = \"USDT\"  # Quote asset\nx.interval = \"5m\"  # Kline time interval\nx.kline_lim = 1000  # Kline number of data points per request\nx.columns = [\"open_time\", \"close\"]  # Data columns to include\nprint(f\"All data columns: {ALL_COLUMNS}\")\nasyncio.run(x.download(\"2025-07-01\", \"2025-08-01\"))  # Time in UTC\n\npath = \"data/crypto_data_2025-07-01_2025-08-01.pkl\"\ndata = load_pkl(path, gz=True)\nplot_crypto_data(data, path)\n```\n\n- Output\n\n```bash\nAll data columns: ['open_time', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_volume', 'n_trades', 'taker_buy_base_volume', 'taker_buy_quote_volume', 'unused']\nweight lim: 5000/6000, USDT symbols: 597, spot: 557, margin: 401\n9 intervals * 597 symbols = 5373 requests -> 2.1492 minutes\nleft: 5373/5373\nserver time: 1754371957632, my time: 1754371957664, diff: -32 ms, weight used: 21\nleft: 2884/5373\nserver time: 1754372028132, my time: 1754372028165, diff: -33 ms, weight used: 1\nleft: 385/5373\nserver time: 1754372095736, my time: 1754372095764, diff: -28 ms, weight used: 1\nleft: 0/5373\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "High-speed cryptocurrency OHLCV data downloader via concurrent API requests",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/SerenaTradingResearch/crypto-data-downloader"
    },
    "split_keywords": [
        "crypto",
        " binance",
        " ohlcv",
        " market-data",
        " downloader"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9e1cbf95e8f33330fdbed23df5747d325016eb029f37ab797f3acc3653358090",
                "md5": "d799a5bbb7a8be156d0c3d4c3577132e",
                "sha256": "1565cf66acded45df570e618acefdd7c003201559ccd6897dbec4f9fa10daaf1"
            },
            "downloads": -1,
            "filename": "crypto_data_downloader-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d799a5bbb7a8be156d0c3d4c3577132e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5515,
            "upload_time": "2025-08-05T06:43:48",
            "upload_time_iso_8601": "2025-08-05T06:43:48.822455Z",
            "url": "https://files.pythonhosted.org/packages/9e/1c/bf95e8f33330fdbed23df5747d325016eb029f37ab797f3acc3653358090/crypto_data_downloader-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e474c4f8c48d2c7d3865ff07d6237c6207da760bd80c0aae5c75a8615801a07e",
                "md5": "25fa558ea75bebe4f692b3e0954bc6b2",
                "sha256": "fdc916b165a8ceafd1d69bc312be33d7c612130f3231958098c349eb08918eb7"
            },
            "downloads": -1,
            "filename": "crypto_data_downloader-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "25fa558ea75bebe4f692b3e0954bc6b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4949,
            "upload_time": "2025-08-05T06:43:50",
            "upload_time_iso_8601": "2025-08-05T06:43:50.359453Z",
            "url": "https://files.pythonhosted.org/packages/e4/74/c4f8c48d2c7d3865ff07d6237c6207da760bd80c0aae5c75a8615801a07e/crypto_data_downloader-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 06:43:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SerenaTradingResearch",
    "github_project": "crypto-data-downloader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "aiohttp",
            "specs": []
        }
    ],
    "lcname": "crypto-data-downloader"
}
        
Elapsed time: 1.29204s