Skip to content

Commit

Permalink
only fetch index_json at boot time
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Azulinho committed Aug 9, 2023
1 parent 2400190 commit 460f456
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils/prove-backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 460f456

Please sign in to comment.