Skip to content
Back to skills

Dalio All Weather

ASecurity

A股达利欧全天候/债务周期参考配置:用宽基指数、国债ETF、黄金ETF与商品指数计算相关性、波动率与风险平价权重,并回测年化/最大回撤/夏普 | A-share Ray Dalio all-weather / debt-cycle reference allocator: computes correlations, volatilities, risk-parity-style weights across stocks/bonds/gold/commodities, and backtests CAGR/max-drawdown/Sharpe | A株レイ・ダリオ式オールウェザー/債務サイクル参照配分:幅基指数、国債ETF、金ETF、商品指数から相関・ボラティリティ・リスクパリティ風ウェイトを算出し、年率リターン・最大ドローダウン・シャープレシオでバックテスト

  • 19 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 24, 2026
ai-agentspythongobash

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 6 files and shows the line behind each finding

Scanned September 24, 2026

npx -y skills add Serennity007/awesome-stock-quant-skills --skill dalio-all-weather --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dalio All Weather?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dalio All Weather
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/serennity007-dalio-all-weather/badge)](https://www.skillsdirectory.com/skills/serennity007-dalio-all-weather)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dalio-all-weather
description: A股达利欧全天候/债务周期参考配置:用宽基指数、国债ETF、黄金ETF与商品指数计算相关性、波动率与风险平价权重,并回测年化/最大回撤/夏普 | A-share Ray Dalio all-weather / debt-cycle reference allocator: computes correlations, volatilities, risk-parity-style weights across stocks/bonds/gold/commodities, and backtests CAGR/max-drawdown/Sharpe | A株レイ・ダリオ式オールウェザー/債務サイクル参照配分:幅基指数、国債ETF、金ETF、商品指数から相関・ボラティリティ・リスクパリティ風ウェイトを算出し、年率リターン・最大ドローダウン・シャープレシオでバックテスト
author: Serennity007
license: MIT
---

# 🌧️ 全天候资产配置:用达利欧的“四宫格”给 A 股做参考仓位

经济只有 4 种天气:**增长↑/↓ × 通胀↑/↓**。瑞·达利欧的全天候策略不预测天气,而是让组合在四种天气下承担相等的风险。本技能把它搬到 A 股:用沪深300/中证500、国债ETF、黄金ETF、中证商品期货指数作为代理资产,自动算相关性、波动率、近一年表现,并给出风险平价风格的参考权重与回测摘要。

> ⚠️ **简化示意**:这不是达利欧实盘策略,也不考虑杠杆、费率、滑点、税务与分红再投资。仅供学习研究,不构成投资建议。

---

## 1) 这个技能做什么?

| 能力 | 说明 |
|---|---|
| 拉取历史行情 | 宽基指数、国债/黄金 ETF、商品指数的日线收盘价 |
| 计算相关性矩阵 | 看股票、债券、黄金、商品四类资产有多“不同步” |
| 计算波动率与近 1 年表现 | 年化收益、年化波动、夏普 |
| 风险平价风格配权 | 按逆波动率分配权重,低波动资产自动占更高仓位 |
| 输出回测摘要 | 组合年化收益、最大回撤、夏普比率 |

---

## 2) 全天候的 A 股代理资产

默认使用以下资产代表四个经济象限:

| 经济环境 | 代表资产 | akshare 代理 |
|---|---|---|
| 增长 | A 股宽基 | 沪深300 `sh000300`、中证500 `sh000905` |
| 通缩/衰退 | 国债 | 国债ETF `sh511010` |
| 通胀 | 黄金/商品 | 黄金ETF `sh518880`、中证商品期货指数 |

可以用 `--codes` 传入任意 A 股代码做“小样本”测试(例如 `--codes 600519,000858,600036`),脚本会把它们视为股票类资产并重新配权。

---

## 3) 使用方法

```bash
pip install akshare==1.18.96 pandas

# 默认:用四类资产做全天候参考配置
python scripts/allocation.py --lookback 252 --out allocation.csv

# 小样本测试:只看几只股票的相关性与配权
python scripts/allocation.py --codes 600519,000858,600036 --lookback 60 --out test_alloc.csv
```

参数说明:

- `--codes`: 逗号分隔的 A 股代码(可选,默认使用内置全天候资产池)
- `--lookback`: 回看交易日数(默认 252,约一年);也支持 `YYYYMMDD` 或 `YYYY-MM-DD` 格式作为起始日期
- `--out`: 输出 CSV 路径(默认 `allocation.csv`)

---

## 4) 数据来源与降级策略

- 数据来源为 akshare 公开的东方财富、新浪、同花顺接口。
- 脚本**默认禁用系统代理**(如 `127.0.0.1:7890`),避免本地代理阻断东财/同花顺直连。
- 所有 akshare 调用均包 `_retry_call` 指数退避 3 次,调用间 `time.sleep(0.15)`。
- 东财接口失败时自动降级到新浪/同花顺同类接口;商品指数默认走中证商品期货指数接口。

---

## 5) 配套文件

- `references/dalio_principles.md` — 债务周期八阶段、全天候逻辑、极度透明/极度求真、分散化的圣杯。

---

## 免责声明

本技能仅供学习研究,不构成投资建议。历史回测不代表未来收益;任何配置结果都必须结合当前市场环境、个人风险偏好与独立判断二次确认。

Files in this skill

  • README.en.md2.3 KB
  • README.ja.md2.8 KB
  • README.md2.1 KB
  • SKILL.md3.9 KB
  • references/dalio_principles.md4.6 KB
  • scripts/allocation.py19.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…