more cleanup
This commit is contained in:
parent
3587bd82e1
commit
ee3cdd0ffe
@ -690,8 +690,7 @@ class FreqaiDataKitchen:
|
||||
return full_timerange
|
||||
|
||||
def check_if_new_training_required(self, trained_timerange: TimeRange,
|
||||
metadata: dict,
|
||||
timestamp: int = 0) -> Tuple[bool, TimeRange, int]:
|
||||
metadata: dict) -> Tuple[bool, TimeRange]:
|
||||
|
||||
time = datetime.datetime.now(tz=datetime.timezone.utc).timestamp()
|
||||
|
||||
@ -708,21 +707,19 @@ class FreqaiDataKitchen:
|
||||
trained_timerange.stopts = int(time)
|
||||
retrain = True
|
||||
|
||||
timestamp = trained_timerange.stopts
|
||||
|
||||
if retrain:
|
||||
coin, _ = metadata['pair'].split("/")
|
||||
# set the new model_path
|
||||
self.model_path = Path(self.full_path / str("sub-train" + "-" +
|
||||
str(timestamp)))
|
||||
str(int(trained_timerange.stopts))))
|
||||
|
||||
self.model_filename = "cb_" + coin.lower() + "_" + str(timestamp)
|
||||
self.model_filename = "cb_" + coin.lower() + "_" + str(int(trained_timerange.stopts))
|
||||
# this is not persistent at the moment TODO
|
||||
self.freqai_config['live_trained_timerange'] = str(timestamp)
|
||||
self.freqai_config['live_trained_timerange'] = str(int(trained_timerange.stopts))
|
||||
# enables persistence, but not fully implemented into save/load data yer
|
||||
self.data['live_trained_timerange'] = str(timestamp)
|
||||
self.data['live_trained_timerange'] = str(int(trained_timerange.stopts))
|
||||
|
||||
return retrain, trained_timerange, timestamp
|
||||
return retrain, trained_timerange
|
||||
|
||||
def download_new_data_for_retraining(self, timerange: TimeRange, metadata: dict) -> None:
|
||||
|
||||
|
@ -64,7 +64,6 @@ class IFreqaiModel(ABC):
|
||||
self.training_on_separate_thread = False
|
||||
self.retrain = False
|
||||
self.first = True
|
||||
self.timestamp = 0
|
||||
if self.freqai_info['live_trained_timerange']:
|
||||
self.new_trained_timerange = TimeRange.parse_timerange(
|
||||
self.freqai_info['live_trained_timerange'])
|
||||
@ -157,10 +156,9 @@ class IFreqaiModel(ABC):
|
||||
if not self.training_on_separate_thread:
|
||||
# this will also prevent other pairs from trying to train simultaneously.
|
||||
(self.retrain,
|
||||
self.new_trained_timerange,
|
||||
self.timestamp) = self.dh.check_if_new_training_required(self.new_trained_timerange,
|
||||
metadata,
|
||||
timestamp=self.timestamp)
|
||||
self.new_trained_timerange) = self.dh.check_if_new_training_required(
|
||||
self.new_trained_timerange,
|
||||
metadata)
|
||||
else:
|
||||
logger.info("FreqAI training a new model on background thread.")
|
||||
self.retrain = False
|
||||
|
Loading…
Reference in New Issue
Block a user