Improve resiliance, drop compatibility test

This commit is contained in:
Matthias 2024-07-07 17:11:54 +02:00
parent 62320a361e
commit 004e1101e7
2 changed files with 9 additions and 4 deletions

View File

@ -75,7 +75,9 @@ class HyperoptOutput:
r["results_metrics"]["losses"], r["results_metrics"]["losses"],
), ),
# "Avg profit": # "Avg profit":
f"{r['results_metrics']['profit_mean']:.2%}", f"{r['results_metrics']['profit_mean']:.2%}"
if r["results_metrics"]["profit_mean"] is not None
else "--",
# "Profit": # "Profit":
Text( Text(
"{} {}".format( "{} {}".format(
@ -86,9 +88,11 @@ class HyperoptOutput:
), ),
f"({r['results_metrics']['profit_total']:,.2%})".rjust(10, " "), f"({r['results_metrics']['profit_total']:,.2%})".rjust(10, " "),
) )
if r["results_metrics"]["profit_total_abs"] != 0.0 if r["results_metrics"].get("profit_total_abs", 0) != 0.0
else "--", else "--",
style="green" if r["results_metrics"]["profit_total_abs"] > 0 else "red", style="green"
if r["results_metrics"].get("profit_total_abs", 0) > 0
else "red",
), ),
# "Avg duration": # "Avg duration":
str(r["results_metrics"]["holding_avg"]), str(r["results_metrics"]["holding_avg"]),

View File

@ -324,7 +324,8 @@ def hyperopt_test_result():
"profit_mean": None, "profit_mean": None,
"profit_median": None, "profit_median": None,
"profit_total": 0, "profit_total": 0,
"profit": 0.0, "max_drawdown_account": 0.0,
"max_drawdown_abs": 0.0,
"holding_avg": timedelta(), "holding_avg": timedelta(),
}, # noqa: E501 }, # noqa: E501
"results_explanation": " 0 trades. Avg profit nan%. Total profit 0.00000000 BTC ( 0.00Σ%). Avg duration nan min.", # noqa: E501 "results_explanation": " 0 trades. Avg profit nan%. Total profit 0.00000000 BTC ( 0.00Σ%). Avg duration nan min.", # noqa: E501