/binance-futures-dataset-builder

The dataset builder script extracts the most relevant market data straight from Binance's API and builds a series of datasets that can be used in data science and machine learning projects.

Primary LanguageTypeScript

Binance Futures Dataset Builder

The dataset builder script extracts the most relevant market data straight from Binance's API and builds and stores a series of datasets that can be used in data science and machine learning projects.

These dataset files (updated quarterly) are hosted in Kaggle and can be downloaded from the following URLs:

Funding Rate: Dataset File | Dataset Notebook

Long/Short Ratio: Dataset File | Dataset Notebook

Open Interest: Dataset File | Dataset Notebook

Taker Buy/Sell Volume: Dataset File | Dataset Notebook

Requirements

  • NodeJS: ^v18.17.0

  • NPM: ^v9.6.7

  • Typescript: ^v5.1.6

NOTE: the versions listed above are the ones used to code the script. It may run on older|newer versions.

Project Structure

binance_futures_dataset_builder/
└───dist/
    |   └──...
    node_modules/
    |   └──...
    output/ <- Dataset Files
    |   ├──funding_rate.csv
    |   ├──long_short_ratio.csv
    |   ├──open_interest.csv
    |   └──taker_buy_sell_volume.csv
    src/
    |   └──...
    .gitignore
    package-lock.json
    package.json
    README.md
    tsconfig.json

Getting Started

Install dependencies with:

npm install

Initialize the syncing process with:

npm start

NOTE: if the syncing execution were to fail and stop for any reason, it can be executed again without the risk of corrupting the dataset. Additionally, if your project requires a fresh dataset frequently, download the pruned file/files from Kaggle and place it/them in the output directory.

Dataset Schemas

Funding Rate ?

Name Type Description
timestamp int The record's timestamp in milliseconds
funding_rate float The funding rate value

Open Interest ?

Name Type Description
timestamp int The record's timestamp in milliseconds
sum_open_interest float Total open interest (BTC)
sum_open_interest_value float Total open interest value (USDT)

Long/Short Ratio ?

Name Type Description
timestamp int The record's timestamp in milliseconds
long_account float Long account num ratio of all traders
short_account float Short account num ratio of all traders
long_short_ratio float Long/Short account num ratio of all traders

Taker Buy/Sell Volume ?

Name Type Description
timestamp int The record's timestamp in milliseconds
buy_vol float Total BTC volume bought by Takers
sell_vol float Total BTC volume sold by Takers
buy_sell_ratio float The taker buy/sell ratio

Unit Tests

Since the dataset files are deeply analyzed in Jupyter|Kaggle Notebooks, no unit tests were written. If you wish to see more details regarding these datasets, please visit:

Funding Rate: Dataset File | Dataset Notebook

Long/Short Ratio: Dataset File | Dataset Notebook

Open Interest: Dataset File | Dataset Notebook

Taker Buy/Sell Volume: Dataset File | Dataset Notebook