Skip to content

Commit

Permalink
drop all incorrrect % messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Azulinho committed Aug 3, 2023
1 parent a941fd0 commit 12d3491
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions utils/prove-backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def gather_best_results_per_strategy(self, this: Dict[str, Any]) -> None:
f"{self.strategy} best run {best_run} profit: {best_profit_in_runs:.3f}"
)

def run_optimized_config(self, s_investment: float) -> float:
def run_optimized_config(self) -> float:
"""runs optimized config"""
with open(f"configs/optimized.{self.strategy}.yaml") as cf:
_tickers: Dict[str, Any] = yaml.safe_load(cf.read())["TICKERS"]
Expand All @@ -707,11 +707,8 @@ def run_optimized_config(self, s_investment: float) -> float:
re.findall(r"investment: start: .* end: (\d+\.?\d?)", r)[0]
)

_diff = str(int(100 - ((s_investment / end_investment) * 100)))
if int(_diff) > 0:
_diff = f"+{_diff}"
log_msg(
f" final investment for {self.strategy}: {str(end_investment)} {_diff}%"
f" final investment for {self.strategy}: {str(end_investment)}"
)

return end_investment
Expand Down Expand Up @@ -782,14 +779,13 @@ def run_optimized_config(self, s_investment: float) -> float:
pv.write_optimized_strategy_config(
price_logs, tickers, starting_investment
)
final_investment = pv.run_optimized_config(starting_investment)
final_investment = pv.run_optimized_config()
starting_investment = final_investment

log_msg("COMPLETED WITH RESULTS:")
diff = str(int(100 - ((pv.initial_investment / final_investment) * 100)))
if int(diff) > 0:
diff = f"+{diff}"
log_msg(f" {pv.strategy}: {final_investment} {diff}%")
log_msg(f" {pv.strategy}: {final_investment}")
for f in glob.glob("tmp/*"):
os.remove(f)
for f in glob.glob("configs/coin.*.yaml"):
os.remove(f)
log_msg("PROVE-BACKTESTING: FINISHED")

0 comments on commit 12d3491

Please sign in to comment.