chore: sort pairs by absolute profit

This commit is contained in:
Matthias
2025-07-16 20:22:56 +02:00
parent 8f4dfbf55d
commit c6ed64746c

View File

@@ -515,14 +515,16 @@ def generate_strategy_stats(
best_pair = (
max(
[pair for pair in pair_results if pair["key"] != "TOTAL"], key=lambda x: x["profit_sum"]
[pair for pair in pair_results if pair["key"] != "TOTAL"],
key=lambda x: x["profit_total_abs"],
)
if len(pair_results) > 1
else None
)
worst_pair = (
min(
[pair for pair in pair_results if pair["key"] != "TOTAL"], key=lambda x: x["profit_sum"]
[pair for pair in pair_results if pair["key"] != "TOTAL"],
key=lambda x: x["profit_total_abs"],
)
if len(pair_results) > 1
else None