Metadata-Version: 2.5
Name: binance-datatool
Version: 0.2.1
Summary: A non-official Python toolkit for managing historical market data from data.binance.vision
Project-URL: Repository, https://github.com/lostleaf/binance-datatool
Author: lostleaf
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: binance,crypto,historical-data,market-data,trading
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: aiohttp>=3.13.5
Requires-Dist: loguru>=0.7.3
Requires-Dist: tenacity>=9.1.4
Requires-Dist: tqdm>=4.67.1
Requires-Dist: typer>=0.24.1
Description-Content-Type: text/markdown

# Binance DataTool

[![PyPI](https://img.shields.io/pypi/v/binance-datatool?logo=pypi&logoColor=white)](https://pypi.org/project/binance-datatool/)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue?logo=python&logoColor=white)](https://www.python.org/)
[![License: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-green)](https://github.com/lostleaf/binance-datatool/blob/main/LICENSE)

Binance DataTool is an unofficial CLI for downloading historical Spot, USDⓈ-M Futures, and
COIN-M Futures data from [Binance's public archive](https://data.binance.vision/) and
verifying it locally with SHA256. With the [binance-datatool skill][skill], your AI agent
can discover datasets, preview downloads, and read results as JSON.

## Install

Install the CLI with [pipx](https://pipx.pypa.io/) and Python 3.11 or later.
For downloads, install aria2 with `brew install aria2` on macOS or `sudo apt install aria2`
on Ubuntu/Debian.

```bash
pipx install binance-datatool
export BINANCE_DATATOOL_ARCHIVE_HOME="$HOME/binance_archive"
```

The archive home is where downloads and their checksums are stored. Add the `export` line to
your shell profile to reuse the same directory in future sessions. If your shell cannot find
`binance-datatool` after installation, run `pipx ensurepath` and open a new terminal.

## Download and verify BTCUSDT candles

### With an AI agent

Install the skill from your project directory with `npx` (included with npm).

```bash
npx skills add lostleaf/binance-datatool --skill binance-datatool
```

Paste this prompt into Codex CLI. In Claude Code, start it with `/binance-datatool`.

> `$binance-datatool` Download all available monthly archives of BTCUSDT spot daily candles to
> `~/binance_archive`. Verify the files and tell me how many passed.

### From the command line

```bash
binance-datatool download spot --freq monthly --type klines --interval 1d BTCUSDT
binance-datatool verify spot --freq monthly --type klines --interval 1d BTCUSDT
```

Each ZIP covers one month of daily candles. Look under
`~/binance_archive/data/spot/monthly/klines/BTCUSDT/1d/`. Rerun `download` to fetch missing
or updated files. After a fresh download, `verify` should report verified ZIPs and `0 failed`.
Later runs count ZIPs with a current verification as `skipped`.

## Preview a batch download

Pipe a symbol list into `download --dry-run` to see which files a batch would fetch.

```bash
binance-datatool list-symbols spot --freq monthly --quote USDT --exclude-stables \
  | binance-datatool download spot --freq monthly --type klines --interval 1d --dry-run
```

## Documentation

- To choose a dataset, check [availability by market and archive frequency][datasets],
  then use `list-files` to see which archives Binance publishes for a symbol.
- Run `binance-datatool --help` to list commands. For options and JSON output, see the [CLI reference][cli].
- To work on Binance DataTool, see the [contributor guide][contributing].

[skill]: https://github.com/lostleaf/binance-datatool/blob/main/skills/binance-datatool/SKILL.md
[datasets]: https://github.com/lostleaf/binance-datatool/blob/main/skills/binance-datatool/references/archive-availability.md#datasets-by-market
[cli]: https://github.com/lostleaf/binance-datatool/blob/main/docs/reference/cli/archive.md
[contributing]: https://github.com/lostleaf/binance-datatool/blob/main/docs/README.md
