diff --git a/DEV_LOG.md b/DEV_LOG.md index 89359be..0287813 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -107,5 +107,18 @@ This document tracks all modifications, npm packages, active compilation states, * **Active Bugs**: None. * **Type Checker Status**: Verified clean compilation (`npx tsc --noEmit` returns exit code 0). +--- +## [2026-06-13] - Crypto Bayes Mathematical Refactoring (#ISSUE-013) +### Added +* **Mathematical Specifications & Integration Proof**: Expanded [CryptoMathModal.tsx](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/components/modules/crypto/CryptoMathModal.tsx) with a detailed Section D on the 4-feature client-side Random Forest, Section E on the conjugate Beta-Binomial update, and Section F with the formal calculus integration proof and expanded operational formula. +* **UI Status Badge**: Mounted a static glowing amber status badge `🟡 SYSTEM-AUTARK (OFFLINE-CORE)` in the header of [CryptoDemo.tsx](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/components/modules/crypto/CryptoDemo.tsx) to confirm the module runs 100% locally with zero external API calls. + +### Modified +* **KaTeX Escaping Repairs**: Fixed string escaping anomalies by double-escaping LaTeX backslashes across [CryptoMathModal.tsx](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/components/modules/crypto/CryptoMathModal.tsx) to eliminate runtime KaTeX rendering corruption. +* **`QUANT_ROADMAP.md`**: Synchronized quantitative system specifications under Section 4.V. + +### Active Bugs / Compile Status +* **Active Bugs**: None. +* **Type Checker Status**: Verified clean compilation (`npx tsc --noEmit` returns exit code 0). diff --git a/QUANT_ROADMAP.md b/QUANT_ROADMAP.md index ed99000..67dcaef 100644 --- a/QUANT_ROADMAP.md +++ b/QUANT_ROADMAP.md @@ -166,6 +166,37 @@ Where: --- +### V. Crypto Bayesian Markov & Self-Correcting Engine + +Integrates a two-stage predictive mapping pipeline for cryptocurrency assets (BTC, ETH, SOL) that combines on-chain derivatives data with online Bayesian updates. + +#### 1. Machine Learning Random Forest Classifier +Ensemble of 10 decision trees mapping four features to forecast trend probabilities: +* **Funding Rates (FR)**: Future leverage balance indicators. +* **Open Interest (OI) Volatility**: Contract buildup velocities. +* **Long/Short (LS) Retail Skew**: Sentiment extreme markers. +* **Whale Inflows (W)**: Cold-wallet transfer proxy metrics. + +$$P_{\text{ML}} = \frac{1}{M} \sum_{m=1}^{M} T_m(FR_t, OI_t, LS_t, W_t)$$ + +#### 2. Conjugate Beta-Binomial Update +Continuous ML probability outputs ($P_{\text{ML}}$) are mapped into a discrete Binomial likelihood by defining the Trust-Weight Hyperparameter ($w=12$) as the Effective Sample Size (ESS): +* **Prior distribution**: $\theta \sim \text{Beta}(\alpha_{\text{prior}}, \beta_{\text{prior}})$ +* **Binomial Likelihood pseudo-observations**: $k = P_{\text{ML}} \times w$ (successes), $w - k = (1 - P_{\text{ML}}) \times w$ (failures) +* **Conjugate Posterior Update**: + $$\alpha_{\text{post}} = \alpha_{\text{prior}} + k$$ + $$\beta_{\text{post}} = \beta_{\text{prior}} + (w - k)$$ + +#### 3. Posterior Mean Integration Proof +Integrating the continuous parameter $\theta$ out of the posterior distribution gives the mathematical expectation of the posterior: +$$\mathbb{E}[\theta \mid \text{Data}] = \int_{0}^{1} \theta \cdot P(\theta \mid \text{Data}) \, d\theta = \int_{0}^{1} \theta \cdot \frac{\theta^{\alpha_{\text{post}}-1}(1-\theta)^{\beta_{\text{post}}-1}}{\text{B}(\alpha_{\text{post}}, \beta_{\text{post}})} \, d\theta$$ +$$\mathbb{E}[\theta \mid \text{Data}] = \frac{\text{B}(\alpha_{\text{post}} + 1, \beta_{\text{post}})}{\text{B}(\alpha_{\text{post}}, \beta_{\text{post}})} = \frac{\alpha_{\text{post}}}{\alpha_{\text{post}} + \beta_{\text{post}}}$$ + +#### 4. Expanded Workstation Formula +$$P_{\text{Posterior}} = \frac{\alpha_{\text{prior}} + (P_{\text{ML}} \times w)}{\alpha_{\text{prior}} + \beta_{\text{prior}} + w}$$ + +--- + ## 5. Multi-Regime Transition Classifier The core cognitive brain of the sandbox dynamically adjusts allocation weights across our portfolio modules based on estimated macroeconomic and market states. diff --git a/components/modules/crypto/CryptoDemo.tsx b/components/modules/crypto/CryptoDemo.tsx index c0f7449..ecf53dd 100644 --- a/components/modules/crypto/CryptoDemo.tsx +++ b/components/modules/crypto/CryptoDemo.tsx @@ -185,6 +185,11 @@ export default function CryptoDemo() {