High-speed cryptocurrency OHLCV data downloader via concurrent API requests
Project description
Intro
- Downloads crypto kline (candlestick) data fast by making as many concurrent API requests as possible
- Takes
3 minutesto download1 monthof entire market data (597 symbols), with5 minutestime interval
- Takes
Usage
pip install crypto-data-downloader
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 = f"data/{x.name}_2025-07-01_2025-08-01.pkl"
data = load_pkl(path, gz=True)
plot_crypto_data(data, path)
- Output
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crypto_data_downloader-0.1.9.tar.gz.
File metadata
- Download URL: crypto_data_downloader-0.1.9.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c49bc3d0bca4456d9d5fe75891389d8b1113c91a509b85faa80de0d744ef72f
|
|
| MD5 |
b5525f961fcfc0d3ca943c70739a163b
|
|
| BLAKE2b-256 |
77936cb629004ae41feddeaffc2fbdbd461703ebdd6bbac7d8e2b1f05a1a980b
|
File details
Details for the file crypto_data_downloader-0.1.9-py3-none-any.whl.
File metadata
- Download URL: crypto_data_downloader-0.1.9-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29eda5942ebab76e98014d47aa401c205d02e22f6e5804aa9508a406b57080ac
|
|
| MD5 |
62dbbe3e6dbd61f4aea40d7a930ee5cc
|
|
| BLAKE2b-256 |
481005befa010c069d8c7e154a8dd65f930c400c8c5117e02088e70bfc47d8c5
|