Seamlessly list and download Binance spot trade .zip files from the public S3 bucket
Project description
binance-s3-trades
Seamlessly list and download Binance spot trade .zip archives from Binance’s public S3 bucket.
This project provides:
- a Python API for listing and downloading trade archives
- a command-line interface built with Typer
- parallel downloads using boto3 with unsigned S3 access
Installation
From PyPI
pip install binance-s3-trades
From source
git clone https://github.com/mpolit/binance-s3-trades.git
cd binance-s3-trades
poetry install
Python API
Listing available trade archives
from binance_s3_trades.downloader import create_s3_client, list_files
s3 = create_s3_client(
region="ap-northeast-1",
max_workers=4,
)
keys = list_files(
s3_client=s3,
bucket_name="data.binance.vision",
prefix="data/spot/monthly/trades/",
symbols=["BTCUSDT"],
start="2023-01",
end="2023-03",
)
print(keys)
Downloading trade archives
from binance_s3_trades.downloader import (
create_s3_client,
list_files,
download_all,
)
s3 = create_s3_client(
region="ap-northeast-1",
max_workers=4,
)
keys = list_files(
s3_client=s3,
bucket_name="data.binance.vision",
prefix="data/spot/monthly/trades/",
symbols=["BTCUSDT"],
start="2023-01",
end="2023-03",
)
download_all(
s3_client=s3,
bucket_name="data.binance.vision",
prefix="data/spot/monthly/trades/",
keys=keys,
target_dir="./data",
overwrite=False,
dry_run=False,
max_workers=4,
)
Command-Line Interface
After installation, the binance-s3-trades command is available.
List matching files
binance-s3-trades list \
--symbol BTCUSDT \
--start 2023-01 \
--end 2023-03
Download files
binance-s3-trades download ./data \
--symbol BTCUSDT \
--start 2023-01 \
--overwrite
Dry-run mode
binance-s3-trades download ./data \
--symbol BTCUSDT \
--start 2023-01 \
--dry-run
Run the following for full options:
binance-s3-trades --help
Contributing
Contributions are welcome. Please open an issue or pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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 binance_s3_trades-0.2.2.tar.gz.
File metadata
- Download URL: binance_s3_trades-0.2.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.1 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f9b31f8d89646d8cc13deacdb3525cad4dda1c9c8c3622d4675c7eef0b4b51c
|
|
| MD5 |
2e2e3040a9d775c5bf4179a654a9fdd7
|
|
| BLAKE2b-256 |
ba17a9ab14e6dd5d10b4b137bee42e6224420a4675e1b1792c921fc99a05776d
|
File details
Details for the file binance_s3_trades-0.2.2-py3-none-any.whl.
File metadata
- Download URL: binance_s3_trades-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.1 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a21cbb87f8bafe9fc96235cf5158668817b3775b9b6438cb2acb4b09d0e018db
|
|
| MD5 |
2d419a62118735d23bf1689949700412
|
|
| BLAKE2b-256 |
d831a5903efe342e7a1f4cad21f9824cf5a17dc1a39af011b85273ed278ab652
|