remove assertions, log error if user has not assigned freqai in config, fix stratify bug
This commit is contained in:
parent
35bed842cb
commit
7ff3258607
@ -62,7 +62,6 @@
|
||||
"corr_pairlist": [
|
||||
"BTC/USDT",
|
||||
"ETH/USDT",
|
||||
"LINK/USDT",
|
||||
"DOT/USDT"
|
||||
],
|
||||
"feature_parameters": {
|
||||
|
@ -73,23 +73,26 @@ class FreqaiDataKitchen:
|
||||
self.data_drawer = data_drawer
|
||||
|
||||
def assert_config(self, config: Dict[str, Any], live: bool) -> None:
|
||||
assert config.get('freqai'), "No Freqai parameters found in config file."
|
||||
assert config.get('freqai', {}).get('train_period'), ("No Freqai train_period found in"
|
||||
"config file.")
|
||||
assert type(config.get('freqai', {})
|
||||
.get('train_period')) is int, ('Can only train on full day period.'
|
||||
'No fractional days permitted.')
|
||||
assert config.get('freqai', {}).get('backtest_period'), ("No Freqai backtest_period found"
|
||||
"in config file.")
|
||||
if not live:
|
||||
assert type(config.get('freqai', {})
|
||||
.get('backtest_period')) is int, ('Can only backtest on full day'
|
||||
'backtest_period. Only live/dry mode'
|
||||
'allows fractions of days')
|
||||
assert config.get('freqai', {}).get('identifier'), ("No Freqai identifier found in config"
|
||||
"file.")
|
||||
assert config.get('freqai', {}).get('feature_parameters'), ("No Freqai feature_parameters"
|
||||
"found in config file.")
|
||||
if not config.get('freqai'):
|
||||
logger.error('No Freqai parameters found in config file.')
|
||||
|
||||
# assert config.get('freqai'), "No Freqai parameters found in config file."
|
||||
# assert config.get('freqai', {}).get('train_period'), ("No Freqai train_period found in"
|
||||
# "config file.")
|
||||
# assert type(config.get('freqai', {})
|
||||
# .get('train_period')) is int, ('Can only train on full day period.'
|
||||
# 'No fractional days permitted.')
|
||||
# assert config.get('freqai', {}).get('backtest_period'), ("No Freqai backtest_period found"
|
||||
# "in config file.")
|
||||
# if not live:
|
||||
# assert type(config.get('freqai', {})
|
||||
# .get('backtest_period')) is int, ('Can only backtest on full day'
|
||||
# 'backtest_period. Only live/dry mode'
|
||||
# 'allows fractions of days')
|
||||
# assert config.get('freqai', {}).get('identifier'), ("No Freqai identifier found in config"
|
||||
# "file.")
|
||||
# assert config.get('freqai', {}).get('feature_parameters'), ("No Freqai feature_parameters"
|
||||
# "found in config file.")
|
||||
|
||||
def set_paths(self, metadata: dict, trained_timestamp: int = None,) -> None:
|
||||
self.full_path = Path(self.config['user_data_dir'] /
|
||||
@ -234,6 +237,8 @@ class FreqaiDataKitchen:
|
||||
for i in range(1, len(stratification)):
|
||||
if i % self.freqai_config.get("feature_parameters", {}).get("stratify", 0) == 0:
|
||||
stratification[i] = 1
|
||||
else:
|
||||
stratification = None
|
||||
|
||||
(
|
||||
train_features,
|
||||
|
@ -57,17 +57,18 @@ class IFreqaiModel(ABC):
|
||||
self.config['exchange']['pair_whitelist'])
|
||||
|
||||
def assert_config(self, config: Dict[str, Any]) -> None:
|
||||
|
||||
assert config.get('freqai'), "No Freqai parameters found in config file."
|
||||
assert config.get('freqai', {}).get('data_split_parameters'), ("No Freqai"
|
||||
"data_split_parameters"
|
||||
"in config file.")
|
||||
assert config.get('freqai', {}).get('model_training_parameters'), ("No Freqai"
|
||||
"modeltrainingparameters"
|
||||
"found in config file.")
|
||||
assert config.get('freqai', {}).get('feature_parameters'), ("No Freqai"
|
||||
"feature_parameters found in"
|
||||
"config file.")
|
||||
if not config.get('freqai'):
|
||||
logger.error('No Freqai parameters found in config file.')
|
||||
# assert config.get('freqai'), "No Freqai parameters found in config file."
|
||||
# assert config.get('freqai', {}).get('data_split_parameters'), ("No Freqai"
|
||||
# "data_split_parameters"
|
||||
# "in config file.")
|
||||
# assert config.get('freqai', {}).get('model_training_parameters'), ("No Freqai"
|
||||
# "modeltrainingparameters"
|
||||
# "found in config file.")
|
||||
# assert config.get('freqai', {}).get('feature_parameters'), ("No Freqai"
|
||||
# "feature_parameters found in"
|
||||
# "config file.")
|
||||
|
||||
def start(self, dataframe: DataFrame, metadata: dict, strategy: IStrategy) -> DataFrame:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user