Macro Axes: Inflation & Monetary Pressure
Relevant source files
The following files were used as context for generating this wiki page:The Macro Axes components provide a systematic framework for detecting economic regimes based on inflation, growth, and monetary liquidity signals. These modules form "Layer 2" of the regime detection engine, consuming continuous macro features to produce discrete regime labels. The system is designed to be deterministic and stateless, ensuring byte-identical replay of historical economic environments.
The two primary sub-modules, Monetary Pressure and Inflation/Growth, utilize a three-tier labeling strategy (Raw, Stable, and Active) to manage market noise and signal persistence. These axes provide critical context for the Transition Risk component and help guide strategy-family constraints within the trading environment.
Sources: src/regime_detection/monetary_pressure.py:1-40, src/regime_detection/models.py:228-265, src/regime_detection/configs/core3-v2.0.0.yaml:313-318
Architecture and Data Flow
The architecture follows a strictly layered approach. Raw macro data from sources like FRED (Federal Reserve Economic Data) is processed into continuous z-score features, which are then evaluated against threshold-based rules to determine the current macro regime.
This diagram represents the flow of macro-economic data from raw series to finalized axis outputs.
Sources: src/regime_detection/monetary_pressure.py:126-169, src/regime_detection/axis_builders/monetary_pressure.py, src/regime_detection/_config_layer2.py
Monetary Pressure (Layer 2A)
The Monetary Pressure axis measures the direction and velocity of liquidity changes in the financial system. It primarily monitors yield changes in 2-year and 10-year Treasuries, as well as the broad USD index.
Key Features and Features Configuration
The system computes five specific z-score series to capture different horizons of monetary shifts.
| Feature Name | Description | Default Lookback |
|---|---|---|
yield_change_zscore_2y_63d | 63d change z-score for 2y Treasury yield | 63 days |
yield_change_zscore_10y_63d | 63d change z-score for 10y Treasury yield | 63 days |
broad_usd_index_zscore_63d | 63d change z-score for Broad USD Index | 63 days |
yield_change_zscore_21d_2y | 21d "Rate Shock" variant for 2y yields | 21 days |
yield_change_zscore_21d_10y | 21d "Rate Shock" variant for 10y yields | 21 days |
Sources: src/regime_detection/monetary_pressure.py:17-25, src/regime_detection/_config_layer2.py:11-40
Rule Precedence and Risk Ranking
Classifiers use a strict precedence order where the most severe signal "wins."
- rate_shock:
abs(yield_change_zscore_21d) > 2.0 - tightening_pressure:
yield_change_zscore_63d > 1.5ORbroad_usd_zscore_63d > 1.5 - easing_pressure:
yield_change_zscore_63d < -1.5 - neutral_monetary: Default state if no rules fire.
- unknown: Triggered by insufficient data or cold-start.
Sources: src/regime_detection/monetary_pressure.py:30-65, src/regime_detection/monetary_pressure.py:228-256
Inflation & Growth (Layer 2B)
The Inflation/Growth axis monitors economic momentum and price stability. It integrates survey data (PMI), inflation prints (CPI), and corporate earnings revisions.
Regime Labels
The classifier categorizes the environment into several distinct economic states:
- goldilocks: Stable inflation and positive growth.
- inflation_shock: Rapid acceleration in consumer prices or commodity returns.
- disinflation: Falling inflation rates.
- recession_scare: Negative growth signals combined with market stress.
- recovery_growth: Improving growth from a depressed base.
- earnings_expansion / earnings_contraction: Based on 4-week EPS revision directions.
Sources: src/regime_detection/models.py:228-241, src/regime_detection/axis_builders/inflation_growth.py
Configuration Parameters
The behavior of the axis is controlled by InflationGrowthConfig, which defines staleness thresholds and rule predicates.
| Parameter | Type | Default | Spec Reference |
|---|---|---|---|
cpi_drift_threshold | float | 0.005 | §2B line 3048 |
pmi_goldilocks_threshold | float | 50.0 | §2B line 3051 |
cpi_stale_calendar_days | int | 60 | §2B line 3152 |
dgs10_stale_sessions | int | 5 | §2B line 3154 |
Sources: src/regime_detection/_config_layer2.py:141-185, src/regime_detection/configs/core3-v2.0.0.yaml:457-500
Central Bank Text Evidence
As part of the Monetary Pressure axis, the system includes a central_bank_text_score. This is a deterministic-lexicon substitute for an LLM classifier, used to preserve stateless replay.
The central bank text score provides additional conviction but does not directly trigger regime changes.
Sources: src/regime_detection/_config_layer2.py:91-118, src/regime_detection/monetary_pressure.py:84-93
Data Models and Output
Every axis follows a standardized output structure defined in models.py. This ensures that downstream strategy logic can rely on a consistent interface regardless of the specific axis being queried.
Axis Output Structure
AxisOutput is the base class for both Monetary Pressure and Inflation Growth outputs.
class AxisOutput(BaseModel):
raw_label: str
stable_label: str
active_label: str
evidence: AxisEvidencePayload
data_quality: DataQuality
classification_status: ClassificationStatus | None = None
classification_reason: str | None = None
Sources: src/regime_detection/models.py:169-200
Label Persistence (Hysteresis)
To prevent "flip-flopping" between regimes due to minor threshold breaches, the system applies asymmetric hysteresis. For example, in the core3-v2.0.0.yaml config:
- rate_shock: Holds for 5 sessions.
- tightening_pressure: Holds for 3 sessions.
- easing_pressure: Holds for 2 sessions.
Sources: src/regime_detection/configs/core3-v2.0.0.yaml:438-444
Summary
The Macro Axes (Inflation & Monetary Pressure) provide the economic "ground truth" for the regime detection engine. By transforming volatile macro data into stable, rule-based regimes with clear precedence and persistence logic, the system allows trading strategies to adapt to liquidity cycles and growth shifts. These modules are strictly deterministic, supporting the project's requirement for historical accuracy and reproducible research.