Binance
BinanceKlines
¶
Bases: BaseModel
A class that allows downloading klines from Binance.
Usage
get_futures_klines
¶
get_futures_klines(tf: Timeframes, asset: str = 'BTCUSDT', ago: str = '1 day ago UTC', cache: bool = True, data_directory: str = './data', set_index: bool = True) -> DataFrame
Fetches the Futures (Perp Swaps) klines
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tf |
Timeframes
|
The timeframe to fetch. |
required |
asset |
str
|
The asset name. |
'BTCUSDT'
|
ago |
str
|
The time ago you want to fetch it. Ex: '30 day ago UTC', or '3 months ago UTC' |
'1 day ago UTC'
|
cache |
bool
|
Whether to cache the data. Subsequent calls will not call the API. |
True
|
data_directory |
str
|
The directory where the klines fill be stored as parquet files |
'./data'
|
set_index |
bool
|
Whether to set the index of the returned DataFrame. If True, the 'Date' column will be set as index |
True
|
Source code in src/tradingtoolbox/exchanges/binance.py
Timeframes
¶
Bases: Enum
Timeframes for Binance
Usage:
Attributes:
Name | Type | Description |
---|---|---|
TF_1MINUTE |
Literal
|
Binance 1 minute interval. |
TF_3MINUTE |
Literal
|
Binance 3 minute interval. |
TF_5MINUTE |
Literal
|
Binance 5 minute interval. |
TF_15MINUTE |
Literal
|
Binance 15 minute interval. |
TF_30MINUTE |
Literal
|
Binance 30 minute interval. |
TF_1HOUR |
Literal
|
Binance 1 hour interval. |
TF_2HOUR |
Literal
|
Binance 2 hour interval. |
TF_4HOUR |
Literal
|
Binance 4 hour interval. |
TF_6HOUR |
Literal
|
Binance 6 hour interval. |
TF_8HOUR |
Literal
|
Binance 8 hour interval. |
TF_12HOUR |
Literal
|
Binance 12 hour interval. |
TF_1DAY |
Literal
|
Binance 1 day interval. |
TF_3DAY |
Literal
|
Binance 3 day interval. |
TF_1WEEK |
Literal
|
Binance 1 week interval. |
TF_1MONTH |
Literal
|
Binance 1 month interval. |