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