Install any skill in seconds. Free to start, no credit card required.
Get Started Free →aifinlab/a-share-quant-backtest
A股量化策略回测/因子验证。当用户说"回测"、"策略回测"、"backtest"、"因子验证"、"这个策略历史表现怎么样"、"测一下"、"量化回测"、"历史收益率"、"夏普比率"、"最大回撤"时触发。基于历史K线和财务数据,对用户指定的投资策略进行回测验证,计算收益率/夏普比率/最大回撤/胜率等绩效指标。支持研报风格(formal)和快速结果风格(brief)。
5 of 22 test cases passed with the skill.
Tokens, turns and time describe resource use, not a dollar price.
Lift withheld: 4 comparable cases; this report requires 8.
The instructions your model reads when the skill loads.
SCRIPTS="$SKILLS_ROOT/cn-stock-data/scripts"
# 历史K线(日/周/月)
python "$SCRIPTS/cn_stock_data.py" kline --code [CODE] --period [daily/weekly/monthly] --start [YYYYMMDD] --end [YYYYMMDD]
# 个股财务指标(用于因子验证)
python "$SCRIPTS/cn_stock_data.py" finance --code [CODE]
# 实时行情(辅助)
python "$SCRIPTS/cn_stock_data.py" quote --code [逗号分隔的代码列表]
回测计算使用 Python pandas,不依赖第三方回测框架。所有计算在 Python 脚本中完成。
明确以下要素(用户未指定则使用默认值):
| 要素 | 说明 | 默认值 |
|---|---|---|
| 标的池 | 回测股票范围 | 用户指定(必填) |
| 买入规则 | 入场信号 | 用户指定(必填) |
| 卖出规则 | 出场信号 | 用户指定(必填) |
| 持仓周期 | 最小持仓天数 | 不限(T+1 至少隔日) |
| 调仓频率 | 多久重新评估 | 月度调仓 |
| 仓位管理 | 单只上限/总仓位 | 等权重,单只不超过 20% |
| 回测区间 | 起止日期 | 近 3 年 |
| 基准 | 对标指数 | 沪深300 (000300) |
| 初始资金 | 起始金额 | 100 万元 |
| 交易成本 | 佣金+印花税+滑点 | 佣金万2.5 + 印花税千1(卖出) + 滑点0.1% |
常见策略模板:
test cases passed with the skill
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.