mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-20 22:38:10 +00:00
feat(HPO): added run_hpo script (#237)
* feat(HPO): added `run_hpo` script * fix(Linter): ran * feat(HPO): removed any reference to sweep (superseeded by optuna) * fix(HPO): optimize for sharpe * fix(Config): removed glassnode data, save trials from hpo * feat(Labelling): added three-balanced method works again * fix(BetSizing): set the correct class labels * fix(HPO): powerset should return what's expected, added two new normalization methods * fix(Linter): ran * fix(DataLoader): sort the dataframe when fetching data * fix(Config): only take z-score of other assets
This commit is contained in:
@@ -7,7 +7,7 @@ from numba.typed import List
|
||||
|
||||
|
||||
class CUSUMVolatilityEventFilter(EventFilter):
|
||||
def __init__(self, vol_period: int, multiplier: float):
|
||||
def __init__(self, multiplier: float, vol_period=100):
|
||||
self.vol_period = vol_period
|
||||
self.multiplier = multiplier
|
||||
|
||||
@@ -23,13 +23,14 @@ class CUSUMVolatilityEventFilter(EventFilter):
|
||||
|
||||
|
||||
class CUSUMFixedEventFilter(EventFilter):
|
||||
def __init__(self, threshold: float):
|
||||
self.threshold = threshold
|
||||
def __init__(self, threshold_multiplier: float):
|
||||
self.threshold_multiplier = threshold_multiplier
|
||||
|
||||
def get_event_start_times(self, returns: ReturnSeries) -> pd.DatetimeIndex:
|
||||
diffed_returns = returns.diff()
|
||||
int_indicies = _process_fixed(
|
||||
List(diffed_returns.to_list()), abs(returns.mean()) * self.threshold
|
||||
int_indicies = _process(
|
||||
List(diffed_returns.to_list()),
|
||||
abs(returns.mean()) * self.threshold_multiplier,
|
||||
)
|
||||
|
||||
return pd.DatetimeIndex([returns.index[i] for i in int_indicies])
|
||||
|
||||
@@ -4,5 +4,8 @@ import pandas as pd
|
||||
|
||||
|
||||
class NoEventFilter(EventFilter):
|
||||
def __init__(self, ignored_threshold_multiplier: float):
|
||||
pass
|
||||
|
||||
def get_event_start_times(self, returns: ReturnSeries) -> pd.DatetimeIndex:
|
||||
return returns.index
|
||||
|
||||
Reference in New Issue
Block a user