No project description provided
Project description
Short Overview.
binance_historical_data is a python package (py>=3.8) which makes download of historical crypto data (prices and volumes) from binance server as simple as it can only be. You don’t even need to have an account at binance.com to download all history of crypto data
Data is taken from here: https://data.binance.vision/?prefix=data/spot/
Using this package you will be able to have full historical data of prices and volumes with only 3 lines of python code
And if you need to update already downloaded data then once again 3 lines of python code will do the job
Limitations: The previous day data appears on binance server a few minutes after 0 a.m. UTC
So there is a delay in which you can get the data.
Installation via pip:
pip install binance_historical_data
How to use it
Initialize main object: data_dumper
from binance_historical_data import CandleDataDumper
data_dumper = CandleDataDumper(
path_dir_where_to_dump=".",
str_data_frequency="1m",
)
Arguments:
- path_dir_where_to_dump:
- (string) Path to folder where to dump the data
- str_data_frequency:
- (string) One of [1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h]Frequency of price-volume data candles to get
The one and only method to dump the data
data_dumper.dump_data(
list_tickers=None,
date_start=None,
date_end=None,
is_to_update_existing=False,
)
Arguments:
- list_tickers=None:
- (list) Trading pairs for which to dump dataif equals to None - all USDT pairs will be used
- date_start=None:
- (datetime.date) The date from which to start dumpif equals to None - every trading pair will be dumped from the early begining (the earliest is 2017-01-01)
- date_end=True=None:
- (datetime.date) The last date for which to dump dataif equals to None - Today’s date will be used
- is_to_update_existing=False:
- (bool) Flag if you want to update the data if it’s already exist
Downloaded data format
path_dir_where_to_dump
–> ticker_1 (BTCUSDT)
—-> timefrequency (1m)
——> daily
——–> BTCUSDT-1m-2022-02-01.csv
——–> BTCUSDT-1m-2022-02-02.csv
——–> …
——> monthly
——–> BTCUSDT-1m-2017-11.csv
——–> BTCUSDT-1m-2017-12.csv
——–> …
–> ticker_2 (ETHUSDT)
—-> …
–> …
.csv files columns
“Open time” - Timestamp
“Open”
“High”
“Low”
“Close”
“Volume”
“Close time” - Timestamp
“Quote asset volume”
“Number of trades”
“Taker buy base asset volume”
“Taker buy quote asset volume”
“Ignore”
Examples
How to dump all data for all USDT trading pairs
Please be advised that the first data dump for all trading pairs might take some time (~40 minutes)
data_dumper.dump_data()
How to update data (get all new data)
It’s as easy as running the exactly same method dump_data once again
The data_dumper will find all the dates for which data already exists
and will try to dump only the new data
data_dumper.dump_data()
How to update (reload) data for the asked time period
data_dumper.dump_data(
date_start=datetime.date(year=2021, month=1, day=1),
date_end=datetime.date(year=2022, month=1, day=1),
is_to_update_existing=True
)
How to get all trading pairs (tickers) from binance
print(data_dumper.get_list_all_trading_pairs())
Links
Project local Links
Contacts
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for binance_historical_data-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 906dcf362b9cde54ba8a75818dc0ea776325bb25fa26b57d0037fe816a441ddc |
|
MD5 | d9b83664002dc555462d8e79f00c1f52 |
|
BLAKE2b-256 | 4c2ebc158cc51c88357eb1fb37f65523a6edc503f518e70043225e08c73d908b |
Close
Hashes for binance_historical_data-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdc684f8bb32536e6e8f6959fdeae1b3155be6b534ca08cb4e5c4608162c338a |
|
MD5 | 578e6572cb859f114f8528857e86ab8b |
|
BLAKE2b-256 | d13b95b2feec04f4dfabe310c99a2a0b41e8e546097036ea5b2ed3e81f75adfa |