Previous topic

Historical Downloader (dccd.histo_dl)

This Page

Binance Historical Downloader (dccd.histo_dl.binance)

Objects to download historical data from Binance exchange.

class dccd.histo_dl.binance.FromBinance(path, crypto, span, fiat='USD', form='xlsx')

Bases: dccd.histo_dl.exchange.ImportDataCryptoCurrencies

Class to import crypto-currencies data from the Binance exchange.

Parameters:
path : str

The path where data will be save.

crypto : str

The abreviation of the crypto-currency.

span : {int, ‘weekly’, ‘daily’, ‘hourly’}
  • If str, periodicity of observation.
  • If int, number of the seconds between each observation, minimal span is 60 seconds.
fiat : str

A fiat currency or a crypto-currency. Binance don’t allow fiat currencies, but USD theter.

form : {‘xlsx’, ‘csv’}

Your favorit format. Only ‘xlsx’ and ‘csv’ for the moment.

See also

FromGDax, FromKraken, FromPoloniex

Notes

See Binance API documentation [Rbab00e26f0b6-1] for more details on parameters.

References

[Rbab00e26f0b6-1]https://github.com/binance-exchange/binance-official-api-docs
Attributes:
pair : str

Pair symbol, crypto + fiat.

start, end : int

Timestamp to starting and ending download data.

span : int

Number of seconds between observations.

full_path : str

Path to save data.

form : str

Format to save data.

Methods

import_data(self[, start, end]) Download data from Binance for specific time interval.
save(self[, form, by_period]) Save data by period (default is year) in the corresponding format and file.
get_data(self) Print the dataframe.
get_data(self)

Print the dataframe.

Returns:
Data : pd.DataFrame

Current data.

import_data(self, start='last', end='now')

Download data from Binance for specific time interval.

Parameters:
start : int or str

Timestamp of the first observation of you want as int or date format ‘yyyy-mm-dd hh:mm:ss’ as string.

end : int or str

Timestamp of the last observation of you want as int or date format ‘yyyy-mm-dd hh:mm:ss’ as string.

Returns:
data : pd.DataFrame

Data sorted and cleaned in a data frame.

save(self, form='xlsx', by_period='Y')

Save data by period (default is year) in the corresponding format and file.

TODO : to finish

Parameters:
form : {‘xlsx’, ‘csv’}

Format to save data.

by_period : {‘Y’, ‘M’, ‘D’}
  • If ‘Y’ group data by year.
  • If ‘M’ group data by month.
  • If ‘D’ group data by day.