GithubHelp home page GithubHelp logo

crypto_toolbox's Introduction

Crypto Toolbox

Useful services for cryptocurrency quant trading.

Currently, the services included are:

  • BHDS: Binance Historical Data Service.

Prerequisites

Please refer to the environment.yml file for the setup of the conda environment.

By default, the BHDS service uses $HOME/crypto_data as the base directory. All data will be downloaded into this base directory. The base directory can be changed by setting the environment variable CRYPTO_BASE_DIR.

The BHDS service requires aria2, a lightweight cross-platform download utility. Linux/MacOS x86_64 users may install it with conda or through system package managers:

conda install -c conda-forge aria2

For Arm64 MacOS users, installation can be done with:

brew install aria2

BHDS

Usage (as printed by python cli.py bhds):

NAME
    cli.py bhds - Binance Historical Data Service

SYNOPSIS
    cli.py bhds COMMAND

DESCRIPTION
    Supports types: spot, usdt_futures, coin_futures

COMMANDS
    COMMAND is one of the following:

     compare_aws_quantclass_candle
       Compare AWS candle with Quantclass

     convert_aws_candle_csv
       Converts and merges downloaded candlestick data into Pandas Feather format.

     convert_quantclass_candle_csv
       Converts quantclass candlestick data into Pandas Feather format.

     get_aws_candle
       Downloads daily candlestick data from Binance's AWS data center. All available dates will be downloaded.

     verify_aws_candle
       Verifies the integrity of all AWS candlestick data and deletes incorrect data.

For example, to download 1-hour candlestick data for perpetual contracts BTCUSDT, ETHUSDT, and LTCUSDT from Binance, and then merge them into Pandas Feather format, a suggested download procedure is as follows:

# Download and verify the candlestick data for the first time
python cli.py bhds get_aws_candle usdt_futures 1h BTCUSDT ETHUSDT LTCUSDT
python cli.py bhds verify_all_candle usdt_futures 1h

# Download and verify the candlestick data for the second time, in case some files are missing
python cli.py bhds get_aws_candle usdt_futures 1h BTCUSDT ETHUSDT LTCUSDT
python cli.py bhds verify_all_candle usdt_futures 1h

# Convert and merge into a single Feather file
python cli.py bhds convert_aws_candle_csv usdt_futures 1h

After the download procedure has successfully finished, the directory structure under $CRYPTO_BASE_DIR should look like:

.
├── binance_data
│   ├── aws_data
│   │   └── data
│   │       └── futures
│   │           └── um
│   │               └── daily
│   │                   └── klines
│   │                       ├── BTCUSDT
│   │                       │   └── 1h  [4641 entries exceeds filelimit, not opening dir]
│   │                       ├── ETHUSDT
│   │                       │   └── 1h  [4641 entries exceeds filelimit, not opening dir]
│   │                       └── LTCUSDT
│   │                           └── 1h  [4614 entries exceeds filelimit, not opening dir]
│   └── candle_feather
│       └── usdt_futures
│           └── 1h
│               ├── BTCUSDT.fea
│               ├── ETHUSDT.fea
│               └── LTCUSDT.fea

crypto_toolbox's People

Contributors

lostleaf avatar zhangchitc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.