# Architect Handover Document (`ARCHITECT_HANDOVER.md`) This document outlines the functional state of the Quant Terminal, the mathematical thresholds used by the HSL status triggers, and the structures of active data proxies. --- ## 1. Functional State of the Station The Quant Terminal operates with 7 primary functional modules mounted in [app/page.tsx](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/app/page.tsx): 1. **Sandbox** (`activeTab === 'sandbox'`): Solves Swamy-Arora random effects regressions. 2. **Scanner** (`activeTab === 'scanner'`): Visualizes live asset scanners. 3. **Insider** (`activeTab === 'insider'`): Tracks corporate insider trades. 4. **Krypto Bayes** (`activeTab === 'crypto'`): Implements Bayesian on-chain learning models, featuring a Walk-Forward Multi-Model Ensemble Radar (RF, XGB/GB, LR, SVM, MLP) and 15 independent Beta-Posterior trackers. 5. **Ökonometrie** (`activeTab === 'events'`): Conducts econometric event studies. 6. **Eco Indicators** (`activeTab === 'macro'`): Monitors 21 FRED macroeconomic and credit indicators. 7. **AI Special Silo** (`activeTab === 'tech'`): Tracks the tech CapEx overinvestment cycle. All endpoints support a 60-minute in-memory caching TTL. --- ## 2. Core Mathematical Thresholds & Status Triggers Indicators in the cockpit cards use HSL-tailored status lights (Emerald-Green, Amber, Flashing Neon Rose-Red). ### Macroeconomics Silo (Module 6) * **Card 1 (Inflation & Consumer)**: * `RED`: CPI Inflation YoY $\ge 3.0\%$, Credit Card Delinquencies $> 4.5\%$, or Personal Savings Rate $< 3.0\%$. * `AMBER`: CPI Inflation $\ge 2.5\%$, Credit Card Delinquencies $> 3.5\%$, or Personal Savings Rate $< 4.0\%$. * `GREEN`: Normal operations. * **Card 2 (Valuation & Liquidity)**: * `RED`: Buffett Indicator Ratio $> 150\%$, or M2 money supply trend is `DOWN`. * `AMBER`: Buffett Indicator Ratio $> 130\%$, or Reverse Repo (RRP) volume $< 400$B$. * `GREEN`: Normal valuation limits. * **Card 3 (Yield Curve & Credit)**: * `RED`: 2S10S yield spread is inverted ($< 0.0\%$), or High-Yield Credit Spread $> 5.0\%$. * `AMBER`: 2S10S spread $< 0.1\%$, or High-Yield Credit Spread $> 4.0\%$. * `GREEN`: Positive term structure. ### AI & Tech Silo (Module 7) * **Card 1 (Monetization Gap)**: * `RED`: Minimum Monetization Gap among constituents $< -15\%$ (diminishing segment returns). * `AMBER`: Minimum Monetization Gap $< 0\%$ (CapEx growth outstripping segment revenue growth). * `GREEN`: Positive monetization gap (revenue growing faster than capital expenditures). * **Card 2 (Supply-Chain Velocity)**: * `RED`: Velocity Index $< 1.8x$, or velocity trend is `DOWN` (buyers reducing forward commitments). * `AMBER`: Velocity Index $< 3.0x$ (buyer commitments softening relative to supplier inventory). * `GREEN`: Normal supply speeds ($\ge 3.0x$). * **Card 3 (Infrastructure Leverage)**: * `RED`: Maximum CapEx-to-Depreciation Ratio $> 4.0x$, or maximum Debt-to-Equity Ratio $> 1.2$ (highly leveraged node expansion). * `AMBER`: Maximum CapEx-to-Depreciation $> 2.5x$, or maximum Debt-to-Equity $> 0.8$. * `GREEN`: Asset expansion supported by low-leverage ratios. --- ## 3. Active Data Proxy Models ### AI Special Silo API Response Schema (`/api/tech/ai`) ```json { "dates": ["Q3-24", "Q4-24", "Q1-25", "Q2-25", "Q3-25", "Q4-25", "Q1-26", "Q2-26"], "liveDataAvailable": false, "timestamp": 1781274890000, "metrics": { "monetizationGap": { "name": "ROI-to-CapEx & Monetization Gap", "tickers": { "NVDA": { "current": -5.3, "previous": -4.2, "trend": "DOWN", "segmentRevenueGrowth": 3.1, "capexGrowth": 8.4, "roiToCapex": 2.6, "data": [ { "quarter": "Q3-24", "monetizationGap": 0.0, "roiToCapex": 0.0, "segmentRevenueGrowth": 0.0, "capexGrowth": 0.0 } ] } } }, "supplyChain": { "name": "Nvidia Supply-Chain Velocity Index", "unit": "x", "currentVelocity": 2.2, "previousVelocity": 2.5, "currentTurnover": 5.7, "currentObligations": 18700, "trend": "DOWN", "data": [ { "quarter": "Q3-24", "nvdaInvTurnover": 5.2, "aggregateObligations": 14500, "velocityIndex": 3.2 } ] }, "infrastructure": { "name": "Tech Infrastructure Leverage & Cluster Expansion", "tickers": { "MSFT": { "currentDE": 0.3, "currentCapExDep": 3.9, "trendDE": "UP", "data": [ { "quarter": "Q3-24", "de": 0.34, "capexDep": 3.2, "debt": 77800, "equity": 228900 } ] } } } } } ``` ### Crypto Multi-Model Ensemble API Schema (`/api/crypto/ensemble`) ```json { "isShieldActive": true, "predictions": { "BTC": { "rf": { "T1": 0.62, "T5": 0.58, "T10": 0.54 }, "gb": { "T1": 0.65, "T5": 0.61, "T10": 0.51 }, "lr": { "T1": 0.58, "T5": 0.57, "T10": 0.55 }, "svm": { "T1": 0.60, "T5": 0.59, "T10": 0.56 }, "mlp": { "T1": 0.64, "T5": 0.60, "T10": 0.53 } }, "ETH": { "rf": { "T1": 0.60, "T5": 0.59, "T10": 0.54 }, "gb": { "T1": 0.66, "T5": 0.61, "T10": 0.48 }, "lr": { "T1": 0.58, "T5": 0.55, "T10": 0.56 }, "svm": { "T1": 0.59, "T5": 0.59, "T10": 0.56 }, "mlp": { "T1": 0.64, "T5": 0.59, "T10": 0.55 } }, "SOL": { "rf": { "T1": 0.65, "T5": 0.58, "T10": 0.52 }, "gb": { "T1": 0.63, "T5": 0.63, "T10": 0.54 }, "lr": { "T1": 0.59, "T5": 0.58, "T10": 0.54 }, "svm": { "T1": 0.60, "T5": 0.62, "T10": 0.56 }, "mlp": { "T1": 0.66, "T5": 0.60, "T10": 0.51 } } } } ``` ### PEAD Drift Radar API Response Schema (`/api/scanner`) ```json { "results": [ { "ticker": "NVDA", "name": "NVIDIA Corporation", "peadSector": "Technology", "announcementDate": "2026-05-20", "daysElapsed": 25, "epsActual": 6.12, "epsConsensus": 5.58, "surprisePercent": 9.68, "driftStatus": "Active Drift", "isLiveApi": true } ], "isShieldActive": false } ``` --- ## 4. Fallback Protection & Operational Transparency Levels The workstation enforces zero silent caching or historical data ingestion: * **PEAD Drift Radar**: Uses a dynamic state flag `isLivePeadApi` to toggle status rendering. * *Green Badge (`🟢 LIVE EPS FEED`)*: FMP API endpoint responded with real-world quarterly reports (`isLiveApi: true`). * *Amber Badge (`⚠️ ARCHIV-DATEN (API OFFLINE)`)*: Live API timeout, failure, or developer shield fallback active (`isLiveApi: false`). * **Crypto Bayes Module**: * *Full-Width Scannability*: Layout structured into 100%-width, centered grids containing the Walk-Forward Ensemble Radar and Active Learning Feedback Loop. * *Strict Calendar Time-Locks*: Enforces an ironclad delta check against the fixed system date (`2026-06-17`) through `isHorizonPending`. Horizons (1 day, 5 days, 10 days) remaining within their lock duration strictly display countdowns and remain in a pending state, preventing look-ahead evaluations. * *Row Expulsion*: Clicking "Hide Row" updates the forecast record with `isHidden: true` locally and saves it to LocalStorage. Hidden rows are filtered out from table rendering but remain intact for the metrics engine. * *Hit Ratio Counter*: Formatted as `Hit Ratio Counter: [True Count] True / [Total Resolved Count] Total` using `{tracker.alpha} True / {tracker.alpha + tracker.beta} Total`. * *Countdown Formatter*: Remaining seconds under pending targets are formatted to human-readable durations (e.g. `Verbleibend: 1 Tag, 19 Std`) using `formatRemainingTime`. * *Accordion Matrix*: Each log row is expandable via Chevron toggle, displaying the individual model prediction direction and success/failure correctness status checkmarks upon resolution. * *Multi-Accuracy Tracking*: Shows distinct columns for `T+1 Acc`, `T+5 Acc`, and `T+10 Acc` rather than a single aggregated metric. * *Global Performance Metrics Panel*: Mounted below the feedback loop, presenting Horizon Efficiency (Section A) and Estimator Hit Distribution (Section B) dynamically evaluated from `localStorage` logs. * *Regime Status Indicator*: Renders glassmorphic conditional badges in the header of the Walk-Forward Radar based on `"activeRegime"` in the JSON payload (1 for Calm, 2 for Turbulent, 3 for Churn). * **Quant Python Pipeline (`pipeline.py`)**: * *Intermarket Sentiment Ingestion*: Fetches daily close values for Nasdaq Composite (`^IXIC`), Gold Spot (`GC=F`), VIX (`^VIX`), and Crypto Fear & Greed (Alternative.me API). Incorporates automatic forward-fill (`ffill()`) and backward-fill (`bfill()`) to process data gaps. * *Feature selection gateway*: Restricts features passed to the estimators to those selected by Boruta & PIMP filters, while explicitly prioritizing and bypassing pruning for all high-alpha metrics (`v_supply`, `asopr`, `sth_sopr`, `lth_sopr`, `theta`, `squeeze_risk`, `d_liq`, `f_comp`, `z_f`, `z_f_squeeze_trigger`, `cvd_inst`, `cvd_ret`, `div_cvd`, `lambda_kyle`). * *Dynamic Meta-Learner Calibrator*: Replaces the static $\theta_{\text{conf}} = 0.55$ with a dynamic calibration threshold computed as the mean training correctness probability (`np.mean(train_r_probs)`) inside each model loop, successfully resolving the 50% entropy block. * *Defensive Class Array Check*: Detects if the target classes array has a size smaller than 2, applying deterministic training probability fallbacks.