Skip to content

A simple Python library to download monthly OHLCV data from Binance

License

Notifications You must be signed in to change notification settings

gsmit/monthly-candles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monthly Candles

A lightweight Python library for retrieving historical monthly OHLCV data from Binance. The candle data is sourced from Binance's public spot market data repository, available at https://data.binance.vision/. Retrieved candles are returned as a Polars DataFrame, enabling seamless analysis and further data processing.

Installation

Install by cloning this repository:

https://github.com/gsmit/monthly-candles.git
cd sliding-window-dataset
pip install -e .

Usage

To fetch some candles, simply run the following:

>>> from monthly_candles import fetch
>>> fetch("BTCUSDT", timeframe="1h", start="2019-08", end="2019-10")
shape: (2_208, 7)
┌─────────┬─────────────────────┬──────────┬──────────┬──────────┬──────────┬─────────────┐
│ symboltimestampopenhighlowclosevolume      │
│ ---------------------         │
│ strdatetime[ms]        ┆ f64f64f64f64f64         │
╞═════════╪═════════════════════╪══════════╪══════════╪══════════╪══════════╪═════════════╡
│ BTCUSDT2019-08-01 00:00:0010080.5310155.0610030.1110043.022234.513056 │
│ BTCUSDT2019-08-01 01:00:0010043.010065.079980.010020.291239.042617 │
│ BTCUSDT2019-08-01 02:00:0010022.010038.569988.8810029.27881.44564   │
│ BTCUSDT2019-08-01 03:00:0010027.4710029.889966.389988.021168.458852 │
│ BTCUSDT2019-08-01 04:00:009989.619999.969935.399977.281241.601555 │
│ …       ┆ …                   ┆ …        ┆ …        ┆ …        ┆ …        ┆ …           │
│ BTCUSDT2019-10-31 19:00:009229.969250.09206.899211.041090.639003 │
│ BTCUSDT2019-10-31 20:00:009211.029243.479123.339185.982463.66525  │
│ BTCUSDT2019-10-31 21:00:009182.829200.09013.09126.24114.414399 │
│ BTCUSDT2019-10-31 22:00:009126.229157.079083.869122.691348.611773 │
│ BTCUSDT2019-10-31 23:00:009123.929157.09105.079140.851083.614566 │
└─────────┴─────────────────────┴──────────┴──────────┴──────────┴──────────┴─────────────┘

About

A simple Python library to download monthly OHLCV data from Binance

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages