diff --git a/zhangfei-technical/01-reports/dual_ma_report_20260511_083511.md b/zhangfei-technical/01-reports/dual_ma_report_20260511_083511.md new file mode 100644 index 000000000..904827ed0 --- /dev/null +++ b/zhangfei-technical/01-reports/dual_ma_report_20260511_083511.md @@ -0,0 +1,45 @@ +# 双均线策略回测报告 + +## 策略信息 +- **策略名称**: Dual_MA_5_20 +- **回测期间**: 2023-01-02 至 2024-12-31 +- **初始资金**: 100000.00 元 + +## 绩效指标 + +| 指标 | 值 | +|------|-----| +| 最终资金 | 104436.44 元 | +| 总收益率 | 4.44% | +| 年化收益率 | 2.20% | +| 最大回撤 | 14.31% | +| 夏普比率 | -3.22 | +| 胜率 | 44.44% | +| 总交易次数 | 18 | +| 盈利/亏损 | 8/10 | +| 平均盈亏比 | 0.46% | +| 平均盈利 | 5.75% | +| 平均亏损 | -3.77% | + +## 交易明细 + +| 序号 | 入场日期 | 出场日期 | 持仓天数 | 收益率 | +|------|----------|----------|----------|--------| +| 1 | 2023-01-09 | 2023-01-23 | 14 | -3.46% | +| 2 | 2023-03-24 | 2023-03-31 | 7 | -3.17% | +| 3 | 2023-04-05 | 2023-04-26 | 21 | +1.62% | +| 4 | 2023-05-09 | 2023-05-16 | 7 | -3.79% | +| 5 | 2023-06-12 | 2023-07-05 | 23 | -1.28% | +| 6 | 2023-08-09 | 2023-09-28 | 50 | +6.52% | +| 7 | 2023-10-16 | 2023-11-15 | 30 | +11.41% | +| 8 | 2023-11-30 | 2023-12-01 | 1 | +1.13% | +| 9 | 2023-12-20 | 2024-01-05 | 16 | -6.63% | +| 10 | 2024-01-31 | 2024-02-16 | 16 | -1.30% | +| 11 | 2024-02-21 | 2024-04-22 | 61 | +13.10% | +| 12 | 2024-05-22 | 2024-06-25 | 34 | +4.83% | +| 13 | 2024-06-28 | 2024-07-04 | 6 | +0.09% | +| 14 | 2024-07-05 | 2024-07-19 | 14 | -3.20% | +| 15 | 2024-08-08 | 2024-09-02 | 25 | +7.29% | +| 16 | 2024-09-03 | 2024-09-06 | 3 | -4.70% | +| 17 | 2024-10-31 | 2024-11-13 | 13 | -7.47% | +| 18 | 2024-11-20 | 2024-12-10 | 20 | -2.65% | diff --git a/zhangfei-technical/02-algorithms/dual_ma_backtest.py b/zhangfei-technical/02-algorithms/dual_ma_backtest.py index e5641fcfe..a4971d7a3 100644 --- a/zhangfei-technical/02-algorithms/dual_ma_backtest.py +++ b/zhangfei-technical/02-algorithms/dual_ma_backtest.py @@ -169,10 +169,10 @@ def main(): long_periods=[20, 30, 50, 60]) logger.info("\nTop 5 Parameter Combinations:") for i, row in scan_results.head(5).iterrows(): - logger.info(f" MA({row['short_period']:2d}, {row['long_period']:3d}): " + logger.info(f" MA({int(row['short_period']):2d}, {int(row['long_period']):3d}): " f"Return={row['total_return']*100:6.2f}%, " f"MaxDD={row['max_drawdown']*100:5.2f}%, " - f"Trades={row['total_trades']:2d}") + f"Trades={int(row['total_trades']):2d}") # 4. Save parameter scan results scan_csv_path = os.path.expanduser('~/.openclaw/sanguo_projects/sanguo_quant_live/zhangfei-technical/01-reports/parameter_scan_results.csv')