Data transformer
A data transformer allow you to apply changes on data. It can be used to add financial indicators, remove indicators, or compress columns.
TaDataTransformer
- class Hmile.DataTransformer.TaDataTransformer(dataprovider: DataProvider)
Add all technical analysis indicators to the data
- Variables
dataprovider – The dataprovider to use to get the data
- integrity_for_normalization(data: DataFrame) DataFrame
drop columns with nans and check that std is not too low to avoid nan during normalizing
- Parameters
data (pd.DataFrame) – data to check
- Returns
data cleaned up
- Return type
pd.DataFrame
- transform() Dict[str, DataFrame]
Apply transformation. Return a dict of dataframes with the key the pair and the value the corresponding dataframe. Every dataframe should have the same columns and the same index : The main columns are named be open, high, low, close, volume. In index is the date. The index name is’date’
- Returns
The transformed data
- Return type
Dict[str, pd.DataFrame]
Check the ta lib documentation for more information.
Examples :
from Hmile.DataProvider import YahooDataProvider
from Hmile.DataTransformer import TaDataTransformer
PAIR = "BTCUSD"
START = "2022-01-01"
END = "2022-01-03"
INTERVAL = "hour"
dp = YahooDataProvider([PAIR], START, END, interval=INTERVAL)
# We first need a source of data = a data provider
data_provider = YahooDataProvider()
# Create a data transformer
transformer = TaDataTransformer(data_provider)
# transform the data
data = transformer.transform()