Skip to main content

Binance Data Downloader

Project description

rm-binance-data-downloader

A Python library for downloading, extracting and formatting historical Binance market data.

The package provides a pipeline that:

  1. Downloads data from Binance Vision
  2. Extracts compressed archives
  3. Formats data into a structured dataset

It is designed for fast data preparation for quantitative trading, backtesting and data analysis.


Installation

pip install rm-bdd

Features

  • Download historical Binance data
  • Automatic archive extraction
  • Data formatting pipeline
  • Metadata management
  • Async architecture
  • Easy integration into trading systems

Quick Example

import asyncio
import time

from rm_bdd.data_downloader import DataDownloader
from rm_bdd.data_extractor import DataExtractor
from rm_bdd.data_formatter import DataFormatter
from rm_bdd.binance_metadata_manager import BinanceMetadataManager


class DataManager:

    def __init__(self, downloader, extractor, formatter):
        self._downloader = downloader
        self._extractor = extractor
        self._formatter = formatter

    async def download_and_save(self, symbol, timeframe, date_from=None, date_to=None):

        start = time.time()
        await self._downloader.download(symbol, timeframe, date_from=date_from, date_to=date_to)
        print("download time:", time.time() - start)

        start = time.time()
        await self._extractor.extract(symbol, timeframe, date_from=date_from, date_to=date_to)
        print("extract time:", time.time() - start)

        start = time.time()
        await self._formatter.format(symbol, timeframe, date_from=date_from, date_to=date_to)
        print("format time:", time.time() - start)


async def main():

    downloader = DataDownloader(
        "downloads/",
        BinanceMetadataManager("downloads/metadata.json")
    )

    extractor = DataExtractor(
        "downloads/",
        "extracts/",
        BinanceMetadataManager("extracts/metadata.json")
    )

    formatter = DataFormatter(
        "extracts/",
        "data/",
        BinanceMetadataManager("data/metadata.json")
    )

    manager = DataManager(downloader, extractor, formatter)

    await manager.download_and_save("BTCUSDT", "1m")


asyncio.run(main())

Result Folder Structure

After execution the folders will look like:

downloads/
    BTCUSDT/
    metadata.json

extracts/
    BTCUSDT/
    metadata.json

data/
    BTCUSDT/
    metadata.json

Pipeline Overview

The processing pipeline consists of three stages:

Downloader

Downloads historical data archives from Binance Vision.

Extractor

Extracts downloaded archives.

Formatter

Formats extracted CSV data into a structured dataset ready for analysis.


Metadata Manager

The library uses a metadata system to track downloaded, extracted and formatted data.

This prevents duplicate downloads and processing.


Example Use Case

Typical workflow:

download → extract → format → analyze

Used for:

  • algorithmic trading
  • backtesting
  • machine learning datasets
  • market research

Requirements

Python 3.10+


License

MIT

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

rm_bdd-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rm_bdd-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file rm_bdd-0.1.0.tar.gz.

File metadata

  • Download URL: rm_bdd-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rm_bdd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5044af671070de7facc606902dbd157475cb06cadd639583a7d56d12e340dcf9
MD5 3ee2af416c7119e91b0a7979830856c5
BLAKE2b-256 0352221a816a72bffce56cc8e11c7a343749c3295017f5809bca456c898c3184

See more details on using hashes here.

Provenance

The following attestation bundles were made for rm_bdd-0.1.0.tar.gz:

Publisher: publish_to_pypi.yml on romamyronenko/rm_binance_data_downloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rm_bdd-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rm_bdd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rm_bdd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 119e886000c46a48a1701686e8cacd0e93a55d6e3069c501701857a8d439d23f
MD5 12cb63332e27537f90afda69bf16efdc
BLAKE2b-256 73a01e0d432164aa62daef497a0cfcb1c82fa9e5dbac2f5f8e91d410d360fcc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rm_bdd-0.1.0-py3-none-any.whl:

Publisher: publish_to_pypi.yml on romamyronenko/rm_binance_data_downloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page