Install any skill in seconds. Free to start, no credit card required.
Get Started Free →aifinlab/a-share-portfolio-optimize
A股量化组合优化。当用户说"组合优化"、"portfolio optimization"、"均值方差"、"风险平价"、"最优权重"、"Black-Litterman"、"最小方差"、"最大夏普"、"怎么分配权重"、"等风险贡献"时触发。基于现代投资组合理论,对给定标的池进行量化权重优化,支持均值方差/最小方差/风险平价/等权等多种方法,输出最优配置权重和有效前沿。支持研报风格(formal)和快速优化风格(brief)。
Passed 12 of 19 test cases with the skill, and 10 of 19 without it.
and 5 more in the full report
6 fixed9 passed either way5 still failing3 broke
Tokens, turns and time describe resource use, not a dollar price.
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] --freq daily --start [起始日期]
# 各资产最新行情
python "$SCRIPTS/cn_stock_data.py" quote --code [CODE1],[CODE2],[CODE3],...
# 无风险利率参照(十年期国债收益率,可手动指定,默认2.5%)
# 大盘基准(有效前沿对比)
python "$SCRIPTS/cn_stock_data.py" kline --code SH000300 --freq daily --start [起始日期]
OPTIM="$SKILLS_ROOT/a-share-portfolio-optimize/scripts"
# 给定资产收益率矩阵,运行组合优化
python "$OPTIM/portfolio_optimizer.py" \
--returns_csv [收益率CSV路径] \
--method [min_var|max_sharpe|risk_parity|equal_weight] \
--rf 0.025 \
--long_only \
--max_weight 0.40
Step 1: 输入资产池与约束
收集用户信息:
| 项目 | 说明 | 默认值 |
|---|---|---|
| 资产池 | 股票代码列表 | 用户提供 |
| 历史窗口 | 用于估计参数的历史区间 | 近1年(250交易日) |
| 优化方法 | min_var / max_sharpe / risk_parity / equal_weight / BL | max_sharpe |
| 无风险利率 | Rf | 2.5% |
| 约束条件 | 做多约束、个股上限、行业上限 | long_only, max 40% |
test cases passed, vs 10 / 19 without
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.