mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-11 08:40:46 +00:00
Output mixed tags table
This commit is contained in:
@@ -26,7 +26,7 @@ def _get_line_header(
|
||||
Generate header lines (goes in line with _generate_result_line())
|
||||
"""
|
||||
return [
|
||||
first_column,
|
||||
*([first_column] if isinstance(first_column, str) else first_column),
|
||||
direction,
|
||||
"Avg Profit %",
|
||||
f"Tot Profit {stake_currency}",
|
||||
@@ -79,20 +79,30 @@ def text_table_tags(tag_type: str, tag_results: List[Dict[str, Any]], stake_curr
|
||||
:param stake_currency: stake-currency - used to correctly name headers
|
||||
:return: pretty printed table with tabulate as string
|
||||
"""
|
||||
floatfmt = _get_line_floatfmt(stake_currency)
|
||||
fallback: str = ""
|
||||
is_list = False
|
||||
if tag_type == "enter_tag":
|
||||
headers = _get_line_header("Enter Tag", stake_currency, "Entries")
|
||||
else:
|
||||
elif tag_type == "exit_tag":
|
||||
headers = _get_line_header("Exit Reason", stake_currency, "Exits")
|
||||
fallback = "exit_reason"
|
||||
else:
|
||||
# Mix tag
|
||||
headers = _get_line_header(["Enter Tag", "Exit Reason"], stake_currency, "Trades")
|
||||
floatfmt.insert(0, "s")
|
||||
is_list = True
|
||||
|
||||
floatfmt = _get_line_floatfmt(stake_currency)
|
||||
output = [
|
||||
[
|
||||
(
|
||||
t["key"]
|
||||
*(
|
||||
(
|
||||
(t["key"] if isinstance(t["key"], list) else [t["key"], ""])
|
||||
if is_list
|
||||
else [t["key"]]
|
||||
)
|
||||
if t.get("key") is not None and len(str(t["key"])) > 0
|
||||
else t.get(fallback, "OTHER")
|
||||
else [t.get(fallback, "OTHER")]
|
||||
),
|
||||
t["trades"],
|
||||
t["profit_mean_pct"],
|
||||
@@ -412,6 +422,13 @@ def show_backtest_result(
|
||||
print(" EXIT REASON STATS ".center(len(table.splitlines()[0]), "="))
|
||||
print(table)
|
||||
|
||||
if (mix_tag := results.get("mix_tag_stats")) is not None:
|
||||
table = text_table_tags("mix_tag", mix_tag, stake_currency)
|
||||
|
||||
if isinstance(table, str) and len(table) > 0:
|
||||
print(" MIXED TAG STATS ".center(len(table.splitlines()[0]), "="))
|
||||
print(table)
|
||||
|
||||
for period in backtest_breakdown:
|
||||
if period in results.get("periodic_breakdown", {}):
|
||||
days_breakdown_stats = results["periodic_breakdown"][period]
|
||||
|
||||
Reference in New Issue
Block a user