Allow user to user pair_dict for persistent storage of custom data

This commit is contained in:
robcaulk 2022-08-09 16:03:10 +02:00
parent aef086b02e
commit e7de812948
2 changed files with 6 additions and 5 deletions

View File

@ -31,6 +31,7 @@ class pair_info(TypedDict):
trained_timestamp: int
priority: int
data_path: str
extras: dict
class FreqaiDataDrawer:
@ -87,7 +88,7 @@ class FreqaiDataDrawer:
self.old_DBSCAN_eps: Dict[str, float] = {}
self.empty_pair_dict: pair_info = {
"model_filename": "", "trained_timestamp": 0,
"priority": 1, "first": True, "data_path": ""}
"priority": 1, "first": True, "data_path": "", "extras": {}}
def load_drawer_from_disk(self):
"""

View File

@ -252,16 +252,16 @@ class FreqaiExampleStrategy(IStrategy):
if (
"prediction" + entry_tag not in pair_dict[pair]
or pair_dict[pair]["prediction" + entry_tag] == 0
or pair_dict[pair]['extras']["prediction" + entry_tag] == 0
):
with self.freqai.lock:
pair_dict[pair]["prediction" + entry_tag] = abs(trade_candle["&-s_close"])
pair_dict[pair]['extras']["prediction" + entry_tag] = abs(trade_candle["&-s_close"])
if not follow_mode:
self.freqai.dd.save_drawer_to_disk()
else:
self.freqai.dd.save_follower_dict_to_disk()
roi_price = pair_dict[pair]["prediction" + entry_tag]
roi_price = pair_dict[pair]['extras']["prediction" + entry_tag]
roi_time = self.max_roi_time_long.value
roi_decay = roi_price * (
@ -299,7 +299,7 @@ class FreqaiExampleStrategy(IStrategy):
pair_dict = self.freqai.dd.follower_dict
with self.freqai.lock:
pair_dict[pair]["prediction" + entry_tag] = 0
pair_dict[pair]['extras']["prediction" + entry_tag] = 0
if not follow_mode:
self.freqai.dd.save_drawer_to_disk()
else: