add docstrings to new functions, remove superceded code
This commit is contained in:
parent
5e914d5756
commit
6da7a98857
@ -726,6 +726,14 @@ class FreqaiDataKitchen:
|
|||||||
return full_timerange
|
return full_timerange
|
||||||
|
|
||||||
def check_if_model_expired(self, trained_timestamp: int) -> bool:
|
def check_if_model_expired(self, trained_timestamp: int) -> bool:
|
||||||
|
"""
|
||||||
|
A model age checker to determine if the model is trustworthy based on user defined
|
||||||
|
`expiration_hours` in the configuration file.
|
||||||
|
:params:
|
||||||
|
trained_timestamp: int = The time of training for the most recent model.
|
||||||
|
:returns:
|
||||||
|
bool = If the model is expired or not.
|
||||||
|
"""
|
||||||
time = datetime.datetime.now(tz=datetime.timezone.utc).timestamp()
|
time = datetime.datetime.now(tz=datetime.timezone.utc).timestamp()
|
||||||
elapsed_time = (time - trained_timestamp) / 3600 # hours
|
elapsed_time = (time - trained_timestamp) / 3600 # hours
|
||||||
max_time = self.freqai_config.get('expiration_hours', 0)
|
max_time = self.freqai_config.get('expiration_hours', 0)
|
||||||
|
@ -113,6 +113,13 @@ class IFreqaiModel(ABC):
|
|||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def start_scanning(self, strategy: IStrategy) -> None:
|
def start_scanning(self, strategy: IStrategy) -> None:
|
||||||
|
"""
|
||||||
|
Function designed to constantly scan pairs for retraining on a separate thread (intracandle)
|
||||||
|
to improve model youth. This function is agnostic to data preparation/collection/storage,
|
||||||
|
it simply trains on what ever data is available in the self.data_drawer.
|
||||||
|
:params:
|
||||||
|
strategy: IStrategy = The user defined strategy class
|
||||||
|
"""
|
||||||
while 1:
|
while 1:
|
||||||
for pair in self.config.get('exchange', {}).get('pair_whitelist'):
|
for pair in self.config.get('exchange', {}).get('pair_whitelist'):
|
||||||
if self.data_drawer.pair_dict[pair]['priority'] != 1:
|
if self.data_drawer.pair_dict[pair]['priority'] != 1:
|
||||||
@ -247,12 +254,6 @@ class IFreqaiModel(ABC):
|
|||||||
# then save model and metadata.
|
# then save model and metadata.
|
||||||
# if not trainable, load existing data
|
# if not trainable, load existing data
|
||||||
if not self.follow_mode:
|
if not self.follow_mode:
|
||||||
# if trained_timestamp != 0: # historical model available
|
|
||||||
# dh.set_paths(metadata['pair'], trained_timestamp)
|
|
||||||
# # file_exists = self.model_exists(metadata['pair'],
|
|
||||||
# # dh,
|
|
||||||
# # trained_timestamp=trained_timestamp,
|
|
||||||
# # model_filename=model_filename)
|
|
||||||
|
|
||||||
(_,
|
(_,
|
||||||
new_trained_timerange,
|
new_trained_timerange,
|
||||||
@ -271,18 +272,6 @@ class IFreqaiModel(ABC):
|
|||||||
self.scanning = True
|
self.scanning = True
|
||||||
self.start_scanning(strategy)
|
self.start_scanning(strategy)
|
||||||
|
|
||||||
# train the model on the trained timerange
|
|
||||||
# if coin_first and not self.scanning:
|
|
||||||
# self.train_model_in_series(new_trained_timerange, metadata['pair'],
|
|
||||||
# strategy, dh, data_load_timerange)
|
|
||||||
# elif not coin_first and not self.scanning:
|
|
||||||
# self.scanning = True
|
|
||||||
# self.start_scanning(strategy)
|
|
||||||
|
|
||||||
# elif not trainable and not self.follow_mode:
|
|
||||||
# logger.info(f'{metadata["pair"]} holds spot '
|
|
||||||
# f'{self.data_drawer.pair_dict[metadata["pair"]]["priority"]} '
|
|
||||||
# 'in training queue')
|
|
||||||
elif self.follow_mode:
|
elif self.follow_mode:
|
||||||
dh.set_paths(metadata, trained_timestamp)
|
dh.set_paths(metadata, trained_timestamp)
|
||||||
logger.info('FreqAI instance set to follow_mode, finding existing pair'
|
logger.info('FreqAI instance set to follow_mode, finding existing pair'
|
||||||
|
Loading…
Reference in New Issue
Block a user