量化交易策略系统Quantitative Trading System

// 从数据采集到策略回测的完整量化研究框架// End-to-end quantitative research framework: data ingestion to backtesting

Python Polars NumPy Matplotlib Excel COM Wind
10
策略算法Strategies
68
商品品种Symbols
5yr
回测周期Backtest Period
120%
最高累积收益Best Cumulative Return

系统架构Architecture

四层管道设计,模块解耦,可扩展4-layer pipeline, modular, extensible

01

数据层Data Layer

Wind Excel COM
Parquet 存储
Wind Excel COM
Parquet Storage

02

策略层Strategy Layer

10 种趋势跟踪
信号生成
10 Trend-Following
Signal Generation

03

回测层Backtest Layer

历史模拟
T+1 执行
Historical Sim
T+1 Execution

04

可视化层Visualization

三面板图表
性能报告
3-Panel Charts
Performance Reports

策略性能对比Strategy Performance

基于 AUFI.WI 上海期货交易所黄金 Wind 指数 5 年历史数据回测 Backtested on AUFI.WI (Shanghai Futures Exchange Gold Index), 5-year historical data

策略Strategy 累积收益Cum. Return 年化收益Ann. Return 最大回撤Max DD 交易次数Trades 胜率Win Rate 平均收益Avg Return
TMA (5/20/60) 120.66% 26.99% -22.30% 50 33.33% 25.11%
TMA (10/30/90) 114.63% 25.93% -19.63% 25 0.00% -1.93%
EWMA Long-Only 98.13% 22.93% -13.51% 139 34.78% 1.09%
Donchian (20) 65.89% 16.51% -16.98% 147 87.50% 10.27%
Donchian (50) 65.03% 16.33% -26.09% 108 75.00% 26.03%
EWMA Long-Short 43.13% 11.43% -21.49% 139 34.78% 1.09%
RSI -35.70% -12.48% -60.00% 36 100.00% 9.53%
MACD -4.19% -1.28% -23.03% 108 40.74% 0.98%
Bollinger (20, 2.0) -55.48% -21.67% -65.64% 44 71.43% 1.90%
Bollinger (20, 1.5) -56.20% -22.06% -65.55% 83 61.54% 0.72%

执行价格 = (开盘 + 收盘) / 2  ·  信号日 T 生成,T+1 执行 Execution price = (open + close) / 2  ·  Signal at day T, executed at T+1

回测图表Backtest Charts

点击图片可放大查看Click to enlarge

策略说明Strategy Descriptions

EWMA

价格穿越指数加权移动平均线时产生信号。提供多空和仅做多两个版本。Signals generated when price crosses the exponentially weighted moving average. Long-short and long-only variants.

MACD

利用快慢 EMA 差值及其信号线的交叉判断趋势方向。经典趋势跟踪指标。Fast/slow EMA difference and signal line crossovers for trend direction. A classic trend-following indicator.

Donchian

价格突破 N 周期高点买入,跌破 N 周期低点卖出。海龟交易法则的核心。Buy on N-period high breakout, sell on N-period low breakdown. The core of the Turtle Trading system.

Bollinger

基于移动平均和标准差构建波动率通道,捕捉带宽收窄后的突破行情。Volatility bands based on moving average and standard deviation. Captures breakouts after bandwidth contraction.

RSI

利用超买超卖区间进行均值回归交易。适合震荡行情中的反转捕捉。Mean-reversion trading using overbought/oversold zones. Effective for catching reversals in ranging markets.

TMA

快中慢三条均线的排列关系判断趋势强度。多均线共振减少假信号。Triple moving average alignment for trend strength. Multi-MA resonance reduces false signals.

开源代码Source Code

完整代码已托管在 GitHub,欢迎交流讨论 Full source code on GitHub — contributions and discussions welcome

GitHub →