Skip to main content

binance_pandas_dataframe.

Project description

Overview

binance_pandas_dataframe collects the historical data from https://data.binance.vision and builds Pandas dataframes from them for use in Python.

The code was forked from https://github.com/binance/binance-public-data, and the logic to build the Pandas dataframe was added.

If you want to process data in a tool other than Python, such as R, Julia, or excel, you can use pandas_dataframe_convert to convert the dataframes produced by binance_pandas_dataframe to 'pkl', 'ftr', 'json', 'xlsx', 'csv', 'md', 'latex', or 'parquet'.

Status

Currently only klines work.

Installing

Installing from PyPi

pip install binance_pandas_dataframes

Installing from your git clone.

Flit is used to build the python package for installation with pip. Flit will call pip as required.

This is the best way to do it. In windows, do this from an adminstrator powershell for the symlink permissions.

flit install --symlink

or you can install it this way, you will have to uninstall with pip and reinstall with flit for every change in a source file. flit install

Running the scripts

The scripts are installed in your python Scripts folder which should be in your path.

export STORE_DIRECTORY=<your desired path>

This will configure the default storing directory of the downloaded data. This can be overwritten
by setting an argument(example given below).

download_kline
download_trade
download_aggTrade

Downloads all monthly and daily(for past 35 days) klines/trades/aggTrades of all intervals(applicable to klines only) and symbols.

download_kline --help

This will show the arguments that can be parsed to the scripts which can be used to configure download options.

usage: download_kline [-h] [-s SYMBOLS [SYMBOLS ...]] [-a ALL_SYMBOLS [ALL_SYMBOLS ...]] [-y {2017,2018,2019,2020,2021,2022}] [-folder FOLDER] [-c {0,1}] [-t {spot,um,cm}] [-o OFILE] [--stdout] -i {1m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1mo} [{1m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1mo} ...]

This is a script to download historical klines data

optional arguments: -h, --help show this help message and exit -s SYMBOLS [SYMBOLS ...] Single symbol or multiple symbols separated by space -a ALL_SYMBOLS [ALL_SYMBOLS ...] download all symbols. because you can. -y {2017,2018,2019,2020,2021,2022} Single year to start, read all klines data until today -folder FOLDER Directory to store the downloaded data -c {0,1} 1 to download checksum file, default 0 -t {spot,um,cm} Valid trading types: ['spot', 'um', 'cm'] -o OFILE file for pandas dataframe. Recommend using the .pkl extension. if you want another format for analyzing in R, excel, etc use dataframe_convert.

--stdout write the dataframe to stdandard output. usueful if using a shell pipeline. you can pipe output to dataframe_convert if you want a format for use in excel, R, etc.

-i {1m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1mo} [{1m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1mo} ...] single kline interval or multiple intervals separated by space -i 1m 1w means to download klines interval of 1minute and 1week

e.g. download_kline.cmd -y 2021 -s ETHUSDT -o test.pkl
dataframe_convert -i test.pkl -o test.csv

to download to test.pkl and to create a csv as well

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

binance_pandas_dataframe-0.5.tar.gz (18.7 kB view details)

Uploaded Source

File details

Details for the file binance_pandas_dataframe-0.5.tar.gz.

File metadata

File hashes

Hashes for binance_pandas_dataframe-0.5.tar.gz
Algorithm Hash digest
SHA256 be92e1e16f373f68c4ad1f2801ce2f9d444a70a9b59309e12716abc028c425ee
MD5 ffe20a11d66f87576707d49446fc5f4a
BLAKE2b-256 00aa7c8d08868806367ea3fc79ed5693775927f33dcfd49007e0b1ae9b7fd219

See more details on using hashes here.

Supported by

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