From 460f4566e42dbfa09768da7c443af9574f7eca4f Mon Sep 17 00:00:00 2001 From: Azulinho Date: Wed, 9 Aug 2023 19:01:24 +0100 Subject: [PATCH] only fetch index_json at boot time we were calling index_json.gz on every strategy run (for the same dates). However the index_json.gz only changes every 24 hours. so pulling the same file over and over doesn't impact the bot results. --- utils/prove-backtesting.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/prove-backtesting.py b/utils/prove-backtesting.py index 8299e68..ac412a8 100644 --- a/utils/prove-backtesting.py +++ b/utils/prove-backtesting.py @@ -117,6 +117,11 @@ def __init__(self, cfg: Dict[str, Any]) -> None: self.from_date, self.end_date, self.roll_forward ) self.sort_by: str = cfg["SORT_BY"] + self.index_json: Dict[str, Any] = json.loads( + get_index_json( + f"{self.price_log_service_url}/index_v2.json.gz" + ).content + ) def check_for_invalid_values(self) -> None: """check for invalid values in the config""" @@ -454,11 +459,7 @@ def write_all_coin_configs( ) -> Set[str]: """generate all coinfiles""" - r: requests.Response = get_index_json( - f"{self.price_log_service_url}/index_v2.json.gz" - ) - index: Any = json.loads(r.content) - index_dates = index["DATES"] + index_dates = self.index_json["DATES"] next_run_coins: Dict[str, Any] = self.filter_on_avail_days_with_log( dates, index_dates