feat(Data): added daily_glassnode DataCollection (#99)

This commit is contained in:
Mark Aron Szulyovszky
2022-01-03 13:57:36 +01:00
committed by GitHub
parent 442915f847
commit 867269df2b
64 changed files with 74837 additions and 698 deletions
+2 -11
View File
@@ -1,15 +1,6 @@
import pandas as pd
import numpy as np
## Utility functions
def __get_close_low_high(df: pd.DataFrame) -> tuple[pd.Series, pd.Series, pd.Series]:
close = df['close']
low = df['low']
high = df['high']
return close, low, high
## Feature extractors
from feature_extractors.utils import get_close_low_high
def feature_debug_future_lookahead(df: pd.DataFrame, period: int, is_log_return: bool) -> pd.Series:
return df['returns'].shift(-period)
@@ -37,7 +28,7 @@ def feature_mom(df: pd.DataFrame, period: int, is_log_return: bool) -> pd.Series
return df['close'].pct_change(period)
def feature_STOK(df: pd.DataFrame, period: int, is_log_return: bool) -> pd.Series:
close, low, high = __get_close_low_high(df)
close, low, high = get_close_low_high(df)
STOK = ((close - low.rolling(period).min()) / (high.rolling(period).max() - low.rolling(period).min())) * 100
return STOK