<essential_principles> Asset Trend Deviation Analysis Core Principles
- Single-Asset Detection - Calculate the trend deviation and historical percentile of a single asset
- Historical Comparative Analysis - Compare the current deviation with a user-specified historical date or automatically identified extreme values
- Macro Factor Decomposition - Break down in detail the contribution of each macro proxy indicator to the market regime determination (applicable to supported asset classes)
Wait for the response before continuing.
After reading the workflow, follow its steps completely.
<quick_start> Quick Start
# 安裝依賴
pip install pandas numpy yfinance pandas-datareader statsmodels
# 快速偵測(範例:黃金期貨)
cd skills/evaluate-exponential-trend-deviation-regimes
python scripts/trend_deviation.py --symbol GC=F --quick
# 分析其他資產(範例:S&P 500)
python scripts/trend_deviation.py --symbol ^GSPC --start 1950-01-01
# 完整分析(含宏觀因子,目前支援黃金)
python scripts/trend_deviation.py --symbol GC=F --start 1970-01-01 --include-macro
# 指定歷史參考日期
python scripts/trend_deviation.py --symbol GC=F --compare-peaks "2011-09-06,2020-08-07"
# 生成視覺化圖表(輸出 PNG + JSON)
python scripts/generate_chart.py --output ./output/
</quick_start>
<reference_index>
Reference Documents (references/)
| Document | Content |
|---|---|
| input-schema.md | Detailed definition of input parameters and validation rules |
| methodology.md | Methodology for exponential trend fitting and deviation calculation |
| regime-rules.md | 1970s-like vs 2000s-like regime determination rules |
| data-sources.md | Data sources and alternative options |
| </reference_index> |
<workflows_index>
| Workflow | Purpose |
|---|---|
| detect.md | Single-asset trend deviation detection and regime determination |
| compare.md | Detailed comparative analysis of historical peaks |
| macro.md | Macro factor decomposition and contribution analysis |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON output structure definition |
| output-markdown.md | Markdown report output template |
| </templates_index> |
<scripts_index>
| Script | Purpose |
|---|---|
| trend_deviation.py | Main analysis script: trend fitting, deviation calculation, regime determination |
| generate_chart.py | Visualization chart generation: historical deviation charts with peak annotations |
| </scripts_index> |
<examples_index>
Example Output (examples/)
| Document | Content |
|---|---|
| gold-deviation-2026.json | 2026 Gold Trend Deviation Analysis Example |
| </examples_index> |
<success_criteria> When the Skill executes successfully:
- Successfully fit the exponential trendline of gold prices
- Calculate the current deviation percentage and historical percentile
- Effectively compare with the 2011/1980 peaks
- Synthesize macro proxy indicators to derive the regime determination (1970s-like / 2000s-like)
- Output a complete JSON or Markdown report
- (Optional) Generate a visualization chart (PNG) annotating historical peaks and the current position </success_criteria>