change param record to only get certain params
This commit is contained in:
parent
c4a2ee05e7
commit
07e813dfa0
@ -1,5 +1,5 @@
|
|||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
@ -65,7 +65,6 @@ class IFreqaiModel(ABC):
|
|||||||
self.retrain = False
|
self.retrain = False
|
||||||
self.first = True
|
self.first = True
|
||||||
self.set_full_path()
|
self.set_full_path()
|
||||||
self.record_configs()
|
|
||||||
self.follow_mode: bool = self.freqai_info.get("follow_mode", False)
|
self.follow_mode: bool = self.freqai_info.get("follow_mode", False)
|
||||||
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", True)
|
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", True)
|
||||||
if self.save_backtest_models:
|
if self.save_backtest_models:
|
||||||
@ -98,6 +97,8 @@ class IFreqaiModel(ABC):
|
|||||||
self._threads: List[threading.Thread] = []
|
self._threads: List[threading.Thread] = []
|
||||||
self._stop_event = threading.Event()
|
self._stop_event = threading.Event()
|
||||||
|
|
||||||
|
self.record_params()
|
||||||
|
|
||||||
def __getstate__(self):
|
def __getstate__(self):
|
||||||
"""
|
"""
|
||||||
Return an empty state to be pickled in hyperopt
|
Return an empty state to be pickled in hyperopt
|
||||||
@ -535,16 +536,23 @@ class IFreqaiModel(ABC):
|
|||||||
)
|
)
|
||||||
self.full_path.mkdir(parents=True, exist_ok=True)
|
self.full_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
def record_configs(self) -> None:
|
def record_params(self) -> None:
|
||||||
"""
|
"""
|
||||||
Records configs in the full path for reproducibility
|
Records run params in the full path for reproducibility
|
||||||
"""
|
"""
|
||||||
self.config_record_path = self.full_path / Path("configs")
|
self.params_record_path = self.full_path / "run_params.json"
|
||||||
self.config_record_path.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
for config in self.config["config_files"]:
|
run_params = {
|
||||||
dest_config_path = self.config_record_path / Path(config).name
|
"freqai": self.config.get('freqai', {}),
|
||||||
shutil.copyfile(config, dest_config_path)
|
"timeframe": self.config.get('timeframe'),
|
||||||
|
"stake_amount": self.config.get('stake_amount'),
|
||||||
|
"stake_currency": self.config.get('stake_currency'),
|
||||||
|
"max_open_trades": self.config.get('max_open_trades'),
|
||||||
|
"pairs": self.config.get('exchange', {}).get('pair_whitelist')
|
||||||
|
}
|
||||||
|
|
||||||
|
with open(self.params_record_path, "w") as handle:
|
||||||
|
json.dump(run_params, handle, indent=4)
|
||||||
|
|
||||||
def extract_data_and_train_model(
|
def extract_data_and_train_model(
|
||||||
self,
|
self,
|
||||||
|
Loading…
Reference in New Issue
Block a user