<essential_principles>
The Zeberg–Salomon model simplifies the market into two states:
- RISK_ON: hold stocks (SPY), expansion phase
- RISK_OFF: hold long bonds (TLT), contraction phase
The switching logic is based on the business cycle pattern that "leading indicators weaken first, coincident indicators confirm later".
| Type | Function | Typical components | Lead time |
|---|---|---|---|
| Leading | Early warning | Yield curve, new orders, housing permits | 6-12 months |
| Coincident | Confirmation | Employment, industrial production, real income | Coincident |
Composition method:
- Apply transform to each series (yoy/mom/diff)
- Unify direction (direction +1/-1)
- Rolling z-score standardization
- EMA smoothing
- Weighted composition
Iceberg Event: LeadingIndex < iceberg_threshold
→ 預警:景氣開始轉弱
→ 搭配「領先指標下降」+ 可選「市場亢奮」濾鏡
Sinking Event: CoincidentIndex < sinking_threshold
→ 確認:實體經濟收縮
→ 通常在 Iceberg 之後數月發生
State machine logic:
- RISK_ON → RISK_OFF: Iceberg continuous confirmation + negative slope
- RISK_OFF → RISK_ON: leading indicators rebound above (threshold + hysteresis)
This skill usesNo API key required data sources:
- FRED CSV:
https://fred.stlouisfed.org/graph/fredgraph.csv?id={SERIES_ID} - Yahoo Finance:
yfinancepackage to fetch SPY, TLT, VIX
The script is located in the scripts/ directory and can be run directly.
</essential_principles>
- Construct indicators: synthesize LeadingIndex and CoincidentIndex from FRED data
- Detect events: identify "Iceberg" (leading indicators weakening) and "Sinking" (coincident confirmation)
- Switch signals: generate RISK_ON ↔ RISK_OFF switching events
- Backtest performance: calculate cumulative return, MaxDD, CAGR, and compare with benchmark
Output: switch event list, indicator time series, backtest summary, diagnostic information.
<quick_start>
The fastest way: run the default backtest
cd skills/zeberg-salomon-rotator
pip install pandas numpy yfinance pandas-datareader # 首次使用
python scripts/rotator.py --quick
Example output:
{
"state": "RISK_ON",
"latest_indices": {"LeadingIndex": 0.41, "CoincidentIndex": 0.22},
"iceberg_event": false,
"sinking_event": false,
"last_switch": {"date": "2023-06-30", "action": "EXIT_LONG_BOND_ENTER_EQUITY"}
}
Full backtest:
python scripts/rotator.py --start 2000-01-01 --end 2026-01-01 --output result.json
</quick_start>
- Quick check - view the current business cycle state and latest indicators
- Full backtest - run a complete historical backtest and performance analysis
- Visualization charts - generate multi-panel backtest result charts
- Monitoring mode - set up continuous monitoring and switching alerts
- Methodology learning - understand the logic of the Zeberg-Salomon model
Please choose or directly provide analysis parameters.
After routing, read the corresponding document and execute.
<directory_structure>
zeberg-salomon-rotator/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── manifest.json # 技能元數據
├── workflows/
│ ├── backtest.md # 完整回測工作流
│ ├── visualize.md # 視覺化工作流
│ ├── monitor.md # 持續監控工作流
│ └── analyze.md # 深度分析工作流
├── references/
│ ├── data-sources.md # FRED 系列代碼與資料來源
│ ├── methodology.md # Zeberg-Salomon 方法論解析
│ └── input-schema.md # 完整輸入參數定義
├── templates/
│ ├── output-json.md # JSON 輸出模板
│ └── output-markdown.md # Markdown 報告模板
└── scripts/
├── rotator.py # 主輪動腳本
├── visualize.py # 視覺化繪圖工具
└── fetch_data.py # 數據抓取工具
</directory_structure>
<reference_index>
Methodology: references/methodology.md
- Zeberg-Salomon model concepts
- Iceberg/Sinking event definitions
- Two-state switching logic
Data sources: references/data-sources.md
- FRED series codes (leading/coincident)
- Yahoo Finance asset codes
- Data frequency and alignment
Input parameters: references/input-schema.md
- Complete parameter definitions
- Default values and recommended ranges
</reference_index>
<workflows_index>
| Workflow | Purpose | When to use |
|---|---|---|
| backtest.md | Full historical backtest | When performance analysis is needed |
| visualize.md | Generate visualization charts | When chart presentation is needed |
| monitor.md | Continuous monitoring status | Daily monitoring or alerts |
| analyze.md | In-depth indicator analysis | Understand the current market state |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON output structure definition |
| output-markdown.md | Markdown report template |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| rotator.py | --quick |
Quick check of the current state |
| rotator.py | --start DATE --end DATE |
Full backtest |
| visualize.py | -i result.json -o chart.png |
Generate visualization charts |
| fetch_data.py | --series T10Y3M,PAYEMS |
Fetch FRED data |
| </scripts_index> |
<input_schema_summary>
Core parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
| start_date | string | 2000-01-01 | Backtest start date |
| end_date | string | today | Backtest end date |
| freq | string | M | Frequency (M=monthly) |
| equity_proxy | string | SPY | Risk asset proxy |
| bond_proxy | string | TLT | Long bond proxy |
Threshold parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
| iceberg_threshold | number | -0.3 | Leading indicator threshold |
| sinking_threshold | number | -0.5 | Coincident indicator threshold |
| confirm_periods | int | 2 | Number of consecutive confirmation periods |
| hysteresis | number | 0.15 | Entry/exit spacing |
Full parameter definitions are in references/input-schema.md。
</input_schema_summary>
<output_schema_summary>
{
"skill": "zeberg-salomon-rotator",
"as_of": "2026-01-14",
"state": "RISK_ON",
"latest_indices": {
"LeadingIndex": 0.41,
"CoincidentIndex": 0.22,
"iceberg_event": false,
"sinking_event": false
},
"switch_events": [...],
"backtest_summary": {
"cagr": 0.123,
"max_drawdown": -0.27,
"turnovers": 10
}
}
Full output structure is in templates/output-json.md。
</output_schema_summary>
<success_criteria> Successful execution should produce:
- Current state (RISK_ON or RISK_OFF)
- LeadingIndex and CoincidentIndex values
- Iceberg/sinking event determination
- List of switch events (including date and reason)
- Backtest performance summary (CAGR, MaxDD, number of turnovers)
- Comparison with benchmarks (buy-and-hold, 60/40)
- Diagnostic information (contribution of each indicator)
- Visualization charts (optional, output to
output/directory) </success_criteria>