Skip to content

What (One-liner)

Canvas macro-shock node: input a scenario_id, get a 4-stage w-confidence decay + cross-sector liquidity-drying path + bilingual narration. Rule-based PoC with 3 predefined scenarios (Oil Spike 50%, Rate Hike 100bp, AI Infrastructure Pullback).

How to use

Drop macro_shock_v1 on Canvas, fill scenario_id (3 options). lang auto-derived from browser Accept-Language (en / zh). Typical pattern:

macro_shock_v1 (oil_up_50)

contagion_sim_v1 → risk_management_v1

bear_agent_v1 → meta_strategy

Core formulas

# This operator does NOT do numeric computation — it is a rule-based dict lookup + i18n localization:

result = _SCENARIOS[scenario_id]         # 3 scenarios hard-coded
localized = _pick(result, locale)         # recurse {en, zh} dict
return {ok, scenario_id, name, description, stages[4], liquidity_path[3-4], logic_lineage[3]}

# _normalise_lang(raw):
  None / "" / non-'zh*'   → 'en'
  'zh*' (incl. 'zh-CN', 'zh-HK', 'ZH' etc.) → 'zh'

Three scenarios' w-decay curves:

  • oil_up_50: 1.0 → 0.85 → 0.6 → 0.35
  • rate_hike_100bp: 1.0 → 0.75 → 0.5 → 0.3
  • ai_infra_pullback: 1.0 → 0.7 → 0.45 → 0.25

Assumptions & applicability

Assumptions: 3 predefined scenarios cover common macro shocks; w decays linearly; liquidity path is one-way (no feedback); pd_delta_bp are stylized annual incremental PD estimates; locale is en/zh only.

Applies to: Canvas macro what-if node, institutional stress-test input, teaching demo, pair with contagion_sim for contagion-path overlay.

Does not apply to: true 4D ODE integration, user-defined scenarios, compound shocks, tick-level, quantitative PD calibration.

Input / Output contract

{scenario_id, lang?='en'}{ok, scenario_id, name, description, stages[4], liquidity_path[3-4], logic_lineage[3]}. On error returns {ok:false, error, available[3]}.

Known limitations

  1. Rule-based PoC: 3 scenarios hard-coded, no parametric path; 4D ODE upgrade pending (see reflexivity_4d_ode_v1)
  2. pd_delta_bp are stylized integers: not Merton/KMV/CreditMetrics calibrated output
  3. w values are qualitative: [1.0, ~0.7, ~0.5, ~0.3] not model-derived
  4. Time scale unspecified: 'stages' t=0..3 lack concrete day/week/month unit
  5. No scenario interaction: cannot superpose rate hike + oil spike
  6. locale en/zh only: third language falls back to en

References

Adrian-Boyarchenko-Giannone (2019) Vulnerable Growth + Soros (1987) Alchemy of Finance + Brunnermeier-Pedersen (2009) Market/Funding Liquidity. See frontmatter.

Golden Test

tests/golden/fixtures/tier3/macro_shock/content-locking (tolerance=0, dict is truth). 10 tests:

  • matches_snapshot — 3 scenarios × 2 langs + invalid + list_scenarios full matrix byte-equal
  • determinism — 5 reruns identical
  • all_scenarios_have_4_stages — contract: exactly 4 stages (t=0..3) per scenario
  • w_values_monotone_decreasing — w[0]=1.0 and strictly decreasing per scenario
  • liquidity_path_ordered — order field ascending and contiguous 1..N
  • pd_delta_bp_integer_and_nonneg — type + non-negative locked
  • invalid_scenario_error_path — unknown id → ok=False + bilingual error + raw sid list
  • lang_normalisation — _normalise_lang full edge-case coverage
  • list_scenarios_structure — 3 entries, each {id, name, description}
  • logic_lineage_locked — fixed 3-element bilingual list

Changelog

  • 1.0.0 (2026-04-20) — First Active (Tier 3 batch 1, content-locked)

Verifiable intelligence for the decisions that demand scrutiny.