detect-freight-led-inflation-turn
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<essential_principles>
<principle name="cass_freight_index">
**CASS Freight Index 是最權威的貨運指標**
CASS Freight Index 由 Cass Information Systems 編制,追蹤北美地區的貨運出貨量與支出:
| 指標 | 說明 | 用途 |
|---|---|---|
| Shipments Index | 出貨量指數 | 衡量實體經濟需求強度 |
| Expenditures Index | 運費支出指數 | 衡量物流成本壓力 |
| Shipments YoY | 出貨量年增率 | 偵測週期轉折(主要分析指標) |
| Expenditures YoY | 支出年增率 | 驗證成本傳導 |
數據來源:MacroMicro (透過 Highcharts 爬取)
</principle>
<principle name="freight_leads_inflation">
**貨運量是通膨的領先指標**
核心邏輯:
- 貨運量 ≈ 實體經濟需求強度
- 出貨量下降 → 終端需求減弱 → 定價能力下降
- 歷史上 CASS 指標對 CPI 具有約 4-6 個月的領先性
關鍵訊號不是單月變化,而是「週期轉折」:
- 年增率轉負 (turned negative)
- 創週期新低 (new cycle low) </principle>
當偵測到 CASS 週期轉折:
- 結論是「通膨壓力緩解」而非「通縮」
- 屬於 inflation easing / disinflation regime
- 支持市場對降息或政策轉向的預期
這是跨週期關係辨識:「物流需求動能 → 通膨方向」
</principle>
<principle name="multi_indicator">
**多指標交叉驗證**
建議同時觀察四個 CASS 指標:
- Shipments YoY(主要):需求端訊號
- Expenditures YoY:成本端訊號
- Shipments Index:絕對水準
- Expenditures Index:運費壓力
當 Shipments 和 Expenditures 同時轉負,訊號更為可靠。
</principle>
</essential_principles>
<objective>
偵測 CASS Freight Index 的週期轉折,判斷通膨是否正在放緩。
輸出三層訊號:
- Freight Status: CASS 各指標狀態與週期位置
- Lead Alignment: 與 CPI YoY 的領先對齊分析
- Signal Assessment: 通膨緩解訊號判斷與信心水準 </objective>
<quick_start>
最快的方式:使用 Chrome CDP 抓取數據
Step 1:安裝依賴
bash
pip install requests websocket-client pandas numpyStep 2:啟動 Chrome 調試模式
bash
undefined<essential_principles>
<principle name="cass_freight_index">
**CASS Freight Index is the most authoritative freight indicator**
The CASS Freight Index is compiled by Cass Information Systems, tracking freight shipments and expenditures in North America:
| Indicator | Description | Purpose |
|---|---|---|
| Shipments Index | Shipment Volume Index | Measures the strength of real economic demand |
| Expenditures Index | Freight Expenditure Index | Measures logistics cost pressure |
| Shipments YoY | Shipment YoY Growth Rate | Detects cycle turning points (core analysis indicator) |
| Expenditures YoY | Expenditure YoY Growth Rate | Verifies cost pass-through |
Data Source: MacroMicro (scraped via Highcharts)
</principle>
<principle name="freight_leads_inflation">
**Freight volume is a leading indicator of inflation**
Core Logic:
- Freight volume ≈ strength of real economic demand
- Decline in shipments → weakening end demand → reduced pricing power
- Historically, the CASS indicator has a lead time of approximately 4-6 months over CPI
The key signal is not monthly changes, but "cycle turning points":
- Turned negative YoY
- Reached a new cycle low </principle>
When a CASS cycle turning point is detected:
- Conclusion is "inflation pressure is easing" rather than "deflation"
- Belongs to the inflation easing / disinflation regime
- Supports market expectations of interest rate cuts or policy shifts
This is cross-cycle relationship identification: "Logistics demand momentum → Inflation direction"
</principle>
<principle name="multi_indicator">
**Cross-Validation with Multiple Indicators**
It is recommended to observe the four CASS indicators simultaneously:
- Shipments YoY (primary): Demand-side signal
- Expenditures YoY: Cost-side signal
- Shipments Index: Absolute level
- Expenditures Index: Freight cost pressure
The signal is more reliable when both Shipments and Expenditures turn negative YoY.
</principle>
</essential_principles>
<objective>
Detect cycle turning points of the CASS Freight Index to determine whether inflation is slowing down.
Output three levels of signals:
- Freight Status: Status and cycle position of each CASS indicator
- Lead Alignment: Lead alignment analysis with CPI YoY
- Signal Assessment: Inflation easing signal judgment and confidence level </objective>
<quick_start>
Fastest Method: Use Chrome CDP to Fetch Data
Step 1: Install Dependencies
bash
pip install requests websocket-client pandas numpyStep 2: Launch Chrome Debugging Mode
bash
undefinedWindows
Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" ^
--remote-debugging-port=9222 ^
--remote-allow-origins=* ^
--user-data-dir="%USERPROFILE%.chrome-debug-profile" ^
"https://www.macromicro.me/charts/46877/cass-freight-index"
**Step 3:等待頁面完全載入(圖表顯示),然後執行**
```bash
cd scripts
python fetch_cass_freight.py --cdpStep 4:執行通膨訊號分析
bash
python freight_inflation_detector.py --quickStep 5:生成視覺化圖表
bash
python visualize_freight_cpi.py \
--cache cache/cass_freight_cdp.json \
--output ../../output/freight_cpi_$(date +%Y-%m-%d).png \
--start 1995-01-01輸出範例:
- JSON 分析結果:
json
{
"signal": "inflation_easing",
"confidence": "high",
"freight_yoy": -7.46,
"cycle_status": "negative",
"indicator": "shipments_yoy",
"macro_implication": "通膨壓力正在放緩,未來 CPI 下行風險上升"
}- 視覺化圖表:
output/freight_cpi_2026-01-23.png
備選方法(Selenium):
bash
pip install selenium webdriver-manager
python scripts/fetch_cass_freight.py --selenium --no-headless</quick_start>
<intake>
需要進行什麼分析?
- 快速檢查 - 查看最新的 CASS 指標與通膨先行訊號
- 完整分析 - 執行完整的週期轉折偵測與領先性分析
- 方法論學習 - 了解 CASS 指標與通膨的領先關係
請選擇或直接提供分析參數。
</intake>
<routing>
| Response | Action |
|------------------------------|-------------------------------------------------------------|
| 1, "快速", "quick", "check" | 執行 `python scripts/freight_inflation_detector.py --quick` |
| 2, "完整", "full", "analyze" | 閱讀 `workflows/analyze.md` 並執行 |
| 3, "學習", "方法論", "why" | 閱讀 `references/methodology.md` |
| 提供參數 (如日期範圍) | 閱讀 `workflows/analyze.md` 並使用參數執行 |
路由後,閱讀對應文件並執行。
</routing>
<directory_structure>
detect-freight-led-inflation-turn/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── manifest.json # 技能元資料
├── workflows/
│ ├── analyze.md # 完整分析工作流
│ └── quick-check.md # 快速檢查工作流
├── references/
│ ├── data-sources.md # CASS 數據來源與爬蟲說明
│ ├── methodology.md # 領先性方法論解析
│ └── historical-episodes.md # 歷史案例對照
├── templates/
│ ├── output-json.md # JSON 輸出模板
│ └── output-markdown.md # Markdown 報告模板
├── scripts/
│ ├── fetch_cass_freight.py # MacroMicro CASS 爬蟲
│ ├── fetch_via_cdp.py # Chrome CDP 爬蟲模組
│ ├── freight_inflation_detector.py # 主分析腳本
│ └── visualize_freight_cpi.py # CASS vs CPI 領先性視覺化
└── examples/
└── sample_output.json # 範例輸出</directory_structure>
<reference_index>
方法論: references/methodology.md
- CASS Freight Index 與 CPI 的領先性關係
- 週期轉折偵測邏輯
- 訊號強度評估標準
資料來源: references/data-sources.md
- MacroMicro Highcharts 爬蟲說明
- CASS 四個指標定義
- 快取策略與更新頻率
歷史案例: references/historical-episodes.md
- 2008 金融危機前後
- 2020 疫情期間
- 2022 通膨高峰期
</reference_index>
<workflows_index>
| Workflow | Purpose | 使用時機 |
|---|---|---|
| analyze.md | 完整週期轉折分析 | 需要深度分析時 |
| quick-check.md | 快速檢查訊號 | 日常監控或快速回答 |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON 輸出結構定義 |
| output-markdown.md | Markdown 報告模板 |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| fetch_cass_freight.py | | 使用 CDP 爬取(推薦) |
| fetch_cass_freight.py | | 使用 Selenium 爬取(備選) |
| freight_inflation_detector.py | | 快速檢查最新訊號 |
| freight_inflation_detector.py | | 完整分析 |
| visualize_freight_cpi.py | | 繪製 CASS vs CPI 領先圖 |
| </scripts_index> |
視覺化輸出:CASS vs CPI 領先性對比圖
核心特徵(參考 Bloomberg/Refinitiv 風格):
- CASS 6M Forward:將 CASS Freight Index 向前移動 6 個月,直觀展示領先關係
- 雙軸對比:CPI YoY(左軸藍線)vs CASS Shipments YoY(右軸灰線)
- 衰退區間標記:NBER 官方衰退期以淺色陰影標示
- Bloomberg 深色風格:深藍背景、高對比度配色
快速繪圖:
bash
cd scripts
python visualize_freight_cpi.py \
--cache cache/cass_freight_cdp.json \
--output ../../output/freight_cpi_YYYY-MM-DD.png \
--start 1995-01-01 \
--lead-months 6輸出路徑:(根目錄)
output/freight_cpi_YYYY-MM-DD.png圖表解讀:
- 當 CASS(灰線)先行轉負/創新低,而 CPI(藍線)仍在高位 → 通膨放緩訊號
- 當 CASS 與 CPI 走勢同步 → 領先關係暫時失效,需謹慎解讀
<input_schema>
<parameter name="start_date" required="true">
**Type**: string (ISO YYYY-MM-DD)
**Description**: 分析起始日期
**Example**: "2010-01-01"
</parameter>
<parameter name="end_date" required="false" default="today">
**Type**: string (ISO YYYY-MM-DD)
**Description**: 分析結束日期
</parameter>
<parameter name="indicator" required="false" default="shipments_yoy">
**Type**: string
**Options**: `shipments_index` | `expenditures_index` | `shipments_yoy` | `expenditures_yoy`
**Description**: CASS 指標選擇
- `shipments_yoy`: 出貨量年增率(推薦,主要分析指標)
- `expenditures_yoy`: 支出年增率
- `shipments_index`: 出貨量指數
- `expenditures_index`: 支出指數
</parameter>
<parameter name="lead_months" required="false" default="6">
**Type**: integer
**Description**: 領先 CPI 的月份數
**Range**: 3-12
</parameter>
<parameter name="yoy_threshold" required="false" default="0.0">
**Type**: float
**Description**: 年增率警戒門檻(如 0 表示轉負)
</parameter>
</input_schema>
<output_schema>
參見 的完整結構定義。
templates/output-json.md摘要:
json
{
"signal": "inflation_easing | inflation_rising | neutral",
"confidence": "high | medium | low",
"freight_yoy": -2.9,
"cycle_status": "new_cycle_low | negative | positive",
"indicator": "shipments_yoy",
"macro_implication": "通膨壓力正在放緩,未來 CPI 下行風險上升",
"all_indicators": {
"shipments_index": {...},
"expenditures_index": {...},
"shipments_yoy": {...},
"expenditures_yoy": {...}
}
}</output_schema>
<success_criteria>
分析成功時應產出:
- CASS 四個指標的最新數值
- 選定指標的 YoY 與週期狀態
- 與 CPI 的領先對齊驗證
- 通膨緩解訊號與信心水準
- CASS vs CPI 領先性對比圖(output/freight_cpi_YYYY-MM-DD.png)
- 可操作的宏觀解讀
- 明確標註資料限制與假設 </success_criteria>
"C:\Program Files\Google\Chrome\Application\chrome.exe" ^
--remote-debugging-port=9222 ^
--remote-allow-origins=* ^
--user-data-dir="%USERPROFILE%.chrome-debug-profile" ^
"https://www.macromicro.me/charts/46877/cass-freight-index"
**Step 3: Wait for the page to fully load (chart displayed), then execute**
```bash
cd scripts
python fetch_cass_freight.py --cdpStep 4: Execute Inflation Signal Analysis
bash
python freight_inflation_detector.py --quickStep 5: Generate Visualization Chart
bash
python visualize_freight_cpi.py \
--cache cache/cass_freight_cdp.json \
--output ../../output/freight_cpi_$(date +%Y-%m-%d).png \
--start 1995-01-01Output Example:
- JSON Analysis Result:
json
{
"signal": "inflation_easing",
"confidence": "high",
"freight_yoy": -7.46,
"cycle_status": "negative",
"indicator": "shipments_yoy",
"macro_implication": "Inflation pressure is slowing down, and the downside risk of CPI will rise in the future"
}- Visualization Chart:
output/freight_cpi_2026-01-23.png
Alternative Method (Selenium):
bash
pip install selenium webdriver-manager
python scripts/fetch_cass_freight.py --selenium --no-headless</quick_start>
<intake>
What analysis do you need?
- Quick Check - View the latest CASS indicators and leading inflation signals
- Full Analysis - Execute complete cycle turning point detection and lead analysis
- Methodology Learning - Understand the leading relationship between CASS indicators and inflation
Please select or provide analysis parameters directly.
</intake>
<routing>
| Response | Action |
|------------------------------|-------------------------------------------------------------|
| 1, "快速", "quick", "check" | Execute `python scripts/freight_inflation_detector.py --quick` |
| 2, "完整", "full", "analyze" | Read `workflows/analyze.md` and execute |
| 3, "學習", "方法論", "why" | Read `references/methodology.md` |
| Provide parameters (e.g., date range) | Read `workflows/analyze.md` and execute with parameters |
After routing, read the corresponding document and execute.
</routing>
<directory_structure>
detect-freight-led-inflation-turn/
├── SKILL.md # This document (router)
├── skill.yaml # Frontend display metadata
├── manifest.json # Skill metadata
├── workflows/
│ ├── analyze.md # Full analysis workflow
│ └── quick-check.md # Quick check workflow
├── references/
│ ├── data-sources.md # CASS data sources and scraping instructions
│ ├── methodology.md # Leading relationship methodology analysis
│ └── historical-episodes.md # Historical case comparisons
├── templates/
│ ├── output-json.md # JSON output template
│ └── output-markdown.md # Markdown report template
├── scripts/
│ ├── fetch_cass_freight.py # MacroMicro CASS scraper
│ ├── fetch_via_cdp.py # Chrome CDP scraping module
│ ├── freight_inflation_detector.py # Main analysis script
│ └── visualize_freight_cpi.py # CASS vs CPI leading relationship visualization
└── examples/
└── sample_output.json # Sample output</directory_structure>
<reference_index>
Methodology: references/methodology.md
- Leading relationship between CASS Freight Index and CPI
- Cycle turning point detection logic
- Signal strength evaluation criteria
Data Sources: references/data-sources.md
- MacroMicro Highcharts scraping instructions
- Definitions of the four CASS indicators
- Caching strategy and update frequency
Historical Cases: references/historical-episodes.md
- Before and after the 2008 financial crisis
- During the 2020 pandemic
- The 2022 inflation peak period
</reference_index>
<workflows_index>
| Workflow | Purpose | Usage Scenario |
|---|---|---|
| analyze.md | Complete cycle turning point analysis | When in-depth analysis is required |
| quick-check.md | Quick signal check | Daily monitoring or quick answers |
| </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 |
|---|---|---|
| fetch_cass_freight.py | | Scrape via CDP (recommended) |
| fetch_cass_freight.py | | Scrape via Selenium (alternative) |
| freight_inflation_detector.py | | Quick check of the latest signals |
| freight_inflation_detector.py | | Full analysis |
| visualize_freight_cpi.py | | Plot CASS vs CPI leading relationship chart |
| </scripts_index> |
Visualization Output: CASS vs CPI Leading Relationship Comparison Chart
Core Features (refer to Bloomberg/Refinitiv style):
- CASS 6M Forward: Shift the CASS Freight Index forward by 6 months to intuitively display the leading relationship
- Dual-Axis Comparison: CPI YoY (blue line on left axis) vs CASS Shipments YoY (gray line on right axis)
- Recession Interval Marking: NBER official recession periods marked with light shading
- Bloomberg Dark Style: Dark blue background, high-contrast color scheme
Quick Plotting:
bash
cd scripts
python visualize_freight_cpi.py \
--cache cache/cass_freight_cdp.json \
--output ../../output/freight_cpi_YYYY-MM-DD.png \
--start 1995-01-01 \
--lead-months 6Output Path: (root directory)
output/freight_cpi_YYYY-MM-DD.pngChart Interpretation:
- When CASS (gray line) turns negative/reaches a new low ahead, while CPI (blue line) remains high → Inflation easing signal
- When CASS and CPI trends are synchronized → Leading relationship temporarily invalid, interpretation requires caution
<input_schema>
<parameter name="start_date" required="true">
**Type**: string (ISO YYYY-MM-DD)
**Description**: Analysis start date
**Example**: "2010-01-01"
</parameter>
<parameter name="end_date" required="false" default="today">
**Type**: string (ISO YYYY-MM-DD)
**Description**: Analysis end date
</parameter>
<parameter name="indicator" required="false" default="shipments_yoy">
**Type**: string
**Options**: `shipments_index` | `expenditures_index` | `shipments_yoy` | `expenditures_yoy`
**Description**: CASS indicator selection
- `shipments_yoy`: Shipment YoY growth rate (recommended, core analysis indicator)
- `expenditures_yoy`: Expenditure YoY growth rate
- `shipments_index`: Shipment volume index
- `expenditures_index`: Freight expenditure index
</parameter>
<parameter name="lead_months" required="false" default="6">
**Type**: integer
**Description**: Number of months the indicator leads CPI
**Range**: 3-12
</parameter>
<parameter name="yoy_threshold" required="false" default="0.0">
**Type**: float
**Description**: YoY warning threshold (e.g., 0 means turning negative)
</parameter>
</input_schema>
<output_schema>
Refer to the complete structure definition in .
templates/output-json.mdSummary:
json
{
"signal": "inflation_easing | inflation_rising | neutral",
"confidence": "high | medium | low",
"freight_yoy": -2.9,
"cycle_status": "new_cycle_low | negative | positive",
"indicator": "shipments_yoy",
"macro_implication": "Inflation pressure is slowing down, and the downside risk of CPI will rise in the future",
"all_indicators": {
"shipments_index": {...},
"expenditures_index": {...},
"shipments_yoy": {...},
"expenditures_yoy": {...}
}
}</output_schema>
<success_criteria>
When the analysis is successful, it should produce:
- Latest values of the four CASS indicators
- YoY growth rate and cycle status of the selected indicator
- Lead alignment verification with CPI
- Inflation easing signal and confidence level
- CASS vs CPI Leading Relationship Comparison Chart (output/freight_cpi_YYYY-MM-DD.png)
- Actionable macroeconomic interpretations
- Clear annotation of data limitations and assumptions </success_criteria>