feat: Add margin/Trading mode output to bt-output

This commit is contained in:
Matthias 2024-09-07 08:47:45 +02:00
parent f714e306da
commit 1a2578a4b7
2 changed files with 22 additions and 0 deletions

View File

@ -263,12 +263,32 @@ def text_table_add_metrics(strat_results: Dict) -> None:
else []
)
trading_mode = (
(
[
(
"Trading Mode",
(
""
if not strat_results.get("margin_mode")
or strat_results.get("trading_mode", "spot") == "spot"
else f"{strat_results['margin_mode'].capitalize()} "
)
+ f"{strat_results['trading_mode'].capitalize()}",
)
]
)
if "trading_mode" in strat_results
else []
)
# Newly added fields should be ignored if they are missing in strat_results. hyperopt-show
# command stores these results and newer version of freqtrade must be able to handle old
# results with missing new fields.
metrics = [
("Backtesting from", strat_results["backtest_start"]),
("Backtesting to", strat_results["backtest_end"]),
*trading_mode,
("Max open trades", strat_results["max_open_trades"]),
("", ""), # Empty line to improve readability
(

View File

@ -504,6 +504,8 @@ def generate_strategy_stats(
"exit_profit_only": config["exit_profit_only"],
"exit_profit_offset": config["exit_profit_offset"],
"ignore_roi_if_entry_signal": config["ignore_roi_if_entry_signal"],
"trading_mode": config["trading_mode"],
"margin_mode": config["margin_mode"],
**periodic_breakdown,
**daily_stats,
**trade_stats,