Closes #014 - System-wide handbook sweep, English consolidation & Crypto state persistence
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { BookOpen } from 'lucide-react';
|
||||
import { BookOpen, X } from 'lucide-react';
|
||||
import 'katex/dist/katex.min.css';
|
||||
import { BlockMath, InlineMath } from 'react-katex';
|
||||
|
||||
@@ -26,8 +26,8 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/85 backdrop-blur-md p-4 sm:p-6 md:p-8">
|
||||
<div className="bg-slate-900 border border-slate-800/80 rounded-3xl w-full max-w-4xl h-[80vh] flex flex-col overflow-hidden shadow-2xl relative text-slate-300">
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-955/90 backdrop-blur-md p-4 sm:p-6 md:p-8">
|
||||
<div className="bg-slate-900 border border-slate-800/80 rounded-3xl w-full max-w-4xl h-[80vh] flex flex-col overflow-hidden shadow-2xl relative text-slate-350">
|
||||
|
||||
{/* Modal Header */}
|
||||
<div className="flex justify-between items-center px-6 py-4 bg-slate-950/40 border-b border-slate-800/60">
|
||||
@@ -39,9 +39,10 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="text-slate-400 hover:text-slate-200 bg-slate-950/50 border border-slate-800 hover:border-slate-700 px-3 py-1.5 rounded-lg text-xs font-semibold font-mono transition-all cursor-pointer"
|
||||
className="text-slate-400 hover:text-slate-200 bg-slate-950/50 border border-slate-800 hover:border-slate-700 p-2 rounded-xl transition-all cursor-pointer flex items-center justify-center"
|
||||
aria-label="Close modal"
|
||||
>
|
||||
Schließen (ESC)
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -69,10 +70,10 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
<div className="space-y-3">
|
||||
<h4 className="text-xs font-bold text-rose-400 uppercase tracking-wider font-mono">B. Endogenous Calibration</h4>
|
||||
<p className="text-xs leading-relaxed text-slate-400">
|
||||
Active future matrix cells pre-fill suggested scores by looking up the corresponding historical LMM coefficient <InlineMath math="\beta_{asset\_event\_post}" /> and scaling it to our native score scale:
|
||||
Active future matrix cells pre-fill suggested scores by looking up the corresponding historical LMM coefficient <InlineMath math="\\beta_{\\text{asset}\\_\\text{event}\\_\\text{post}}" /> and scaling it to our native score scale:
|
||||
</p>
|
||||
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
|
||||
<BlockMath math="\text{Score}_{\text{suggested}} = \max\left(-3, \min\left(3, \text{Round}(\beta_{\text{estimate}} \times 100)\right)\right)" />
|
||||
<BlockMath math="\\text{Score}_{\\text{suggested}} = \\max\\left(-3, \\min\\left(3, \\text{Round}(\\beta_{\\text{estimate}} \\times 100)\\right)\\right)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -82,13 +83,17 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
The engine estimates direct event drift and impact returns, isolating asset-level intercepts as random deviances and purging macro volatility using VIX indices:
|
||||
</p>
|
||||
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
|
||||
<BlockMath math="Y_{it} = X_{it}\beta + Z_{it}b_i + \varepsilon_{it}" />
|
||||
<BlockMath math="Y_{it} = X_{it}\\beta + Z_{it}b_i + \\varepsilon_{it}" />
|
||||
<p className="text-[11px] text-slate-400 mt-2 font-mono leading-relaxed">
|
||||
Where:<br/>
|
||||
- <InlineMath math="Y_{it}" /> is the log-return <InlineMath math="\ln(P_t/P_0)" /> of asset <InlineMath math="i" /> at relative index <InlineMath math="t \in [-30, 30]" />.<br/>
|
||||
- <InlineMath math="X_{it}" /> design matrix elements isolate Pre-Event Drift (<InlineMath math="t < 0" />) and Post-Event Impact (<InlineMath math="t \ge 0" />) while controlling for systemic covariates (VIX).<br/>
|
||||
- <InlineMath math="b_i \sim N(0, \sigma_b^2)" /> random intercept captures unique baseline asset variance.<br/>
|
||||
- <InlineMath math="\varepsilon_{it} \sim N(0, \sigma^2)" /> residuals noise.
|
||||
{"Where:"}
|
||||
<br />
|
||||
{"- "}<InlineMath math="Y_{it}" />{" is the log-return "}<InlineMath math="\\ln(P_t/P_0)" />{" of asset "}<InlineMath math="i" />{" at relative index "}<InlineMath math="t \\in [-30, 30]" />{"."}
|
||||
<br />
|
||||
{"- "}<InlineMath math="X_{it}" />{" design matrix elements isolate Pre-Event Drift ("}<InlineMath math="t < 0" />{") and Post-Event Impact ("}<InlineMath math="t \\ge 0" />{") while controlling for systemic covariates (VIX)."}
|
||||
<br />
|
||||
{"- "}<InlineMath math="b_i \\sim N(0, \\sigma_b^2)" />{" random intercept captures unique baseline asset variance."}
|
||||
<br />
|
||||
{"- "}<InlineMath math="\\varepsilon_{it} \\sim N(0, \\sigma^2)" />{" residuals noise."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,15 +106,15 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2 space-y-4">
|
||||
<div>
|
||||
<p className="text-xs text-slate-400 mb-1">Logistic Probability Projection:</p>
|
||||
<BlockMath math="P(\text{Bullish}) = \frac{1}{1 + e^{-\text{Score}}}" />
|
||||
<BlockMath math="P(\\text{Bullish}) = \\frac{1}{1 + e^{-\\text{Score}}}" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-slate-400 mb-1">Optimal Youden Index (J):</p>
|
||||
<BlockMath math="J = \text{Sensitivity} + \text{Specificity} - 1 = \text{TPR} + (1 - \text{FPR}) - 1" />
|
||||
<BlockMath math="J = \\text{Sensitivity} + \\text{Specificity} - 1 = \\text{TPR} + (1 - \\text{FPR}) - 1" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-slate-400 mb-1">Inverting probability optimal threshold <InlineMath math="P^*" /> back to native score <InlineMath math="S^*" /> via Logit:</p>
|
||||
<BlockMath math="S^* = \ln\left(\frac{P^*}{1 - P^*}\right)" />
|
||||
<p className="text-xs text-slate-400 mb-1">{"Inverting probability optimal threshold "}<InlineMath math="P^*" />{" back to native score "}<InlineMath math="S^*" />{" via Logit:"}</p>
|
||||
<BlockMath math="S^* = \\ln\\left(\\frac{P^*}{1 - P^*}\\right)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -121,16 +126,18 @@ export default function EconometricsMathModal({ isOpen, onClose }: EconometricsM
|
||||
</p>
|
||||
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2 space-y-4">
|
||||
<div>
|
||||
<BlockMath math="\hat{S}(t) = \prod_{t_i \le t} \left(1 - \frac{d_i}{n_i}\right)" />
|
||||
<p className="text-[11px] text-slate-400 mt-2 font-mono">
|
||||
Where:<br/>
|
||||
- <InlineMath math="n_i" /> is the number of active asset-run observations at risk at day <InlineMath math="t" />.<br/>
|
||||
- <InlineMath math="d_i" /> is the number of trend-reversal events recorded on day <InlineMath math="t" />.
|
||||
<BlockMath math="\\hat{S}(t) = \\prod_{t_i \\le t} \\left(1 - \\frac{d_i}{n_i}\\right)" />
|
||||
<p className="text-[11px] text-slate-400 mt-2 font-mono leading-relaxed">
|
||||
{"Where:"}
|
||||
<br />
|
||||
{"- "}<InlineMath math="n_i" />{" is the number of active asset-run observations at risk at day "}<InlineMath math="t" />{"."}
|
||||
<br />
|
||||
{"- "}<InlineMath math="d_i" />{" is the number of trend-reversal events recorded on day "}<InlineMath math="t" />{"."}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-slate-400 mb-1">Reversal trigger with 1% Volatility Buffer:</p>
|
||||
<BlockMath math="\text{Sign}(\text{Score}) \times \text{Return} \le -0.01" />
|
||||
<BlockMath math="\\text{Sign}(\\text{Score}) \\times \\text{Return} \\le -0.01" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,20 +43,20 @@ import {
|
||||
|
||||
// Predefined archetypes for Event Creation
|
||||
const ARCHETYPES: Record<string, { name: string; defaultScores: Record<string, number> }> = {
|
||||
'🏦 Fed-Zinsentscheid (FOMC)': {
|
||||
name: 'Fed-Zinsentscheid (FOMC)',
|
||||
'🏦 Fed Rate Decision (FOMC)': {
|
||||
name: 'Fed Rate Decision (FOMC)',
|
||||
defaultScores: { Apple: 1, NASDAQ: 2, Gold: -1, Bitcoin: 2 }
|
||||
},
|
||||
'📈 US-Inflationsdaten (CPI)': {
|
||||
name: 'US-Inflationsdaten (CPI)',
|
||||
'📈 US Inflation Data (CPI)': {
|
||||
name: 'US Inflation Data (CPI)',
|
||||
defaultScores: { Apple: 1, NASDAQ: 2, Gold: -2, Bitcoin: 1 }
|
||||
},
|
||||
'💼 Non-Farm Payrolls (NFP)': {
|
||||
name: 'Non-Farm Payrolls (NFP)',
|
||||
defaultScores: { Apple: 0, NASDAQ: 1, Gold: -1, Bitcoin: 0 }
|
||||
},
|
||||
'🛒 OPEC-Treffen': {
|
||||
name: 'OPEC-Treffen',
|
||||
'🛒 OPEC Meeting': {
|
||||
name: 'OPEC Meeting',
|
||||
defaultScores: { Apple: -1, NASDAQ: -1, Gold: 2, Bitcoin: 1 }
|
||||
}
|
||||
};
|
||||
@@ -258,7 +258,6 @@ export default function EventsDemo() {
|
||||
|
||||
|
||||
|
||||
// Custom Event Form State
|
||||
const [customName, setCustomName] = useState<string>('');
|
||||
const [customDate, setCustomDate] = useState<string>('2026-06-15');
|
||||
const [selectedArchetype, setSelectedArchetype] = useState<string>('Custom');
|
||||
@@ -522,7 +521,7 @@ export default function EventsDemo() {
|
||||
scores[asset.name] = typeof arch.defaultScores[asset.name] === 'number' ? arch.defaultScores[asset.name] : 0;
|
||||
});
|
||||
} else {
|
||||
name = name || 'Benutzerdefiniertes Ereignis';
|
||||
name = name || 'Custom Event';
|
||||
}
|
||||
|
||||
addEventToMatrix(name, customDate, scores);
|
||||
@@ -608,7 +607,7 @@ export default function EventsDemo() {
|
||||
className="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-slate-950/80 hover:bg-slate-905 border border-slate-800 hover:border-slate-700 transition-all font-semibold text-xs tracking-wider text-rose-400"
|
||||
>
|
||||
<BookOpen className="w-3.5 h-3.5" />
|
||||
<span>📖 Modulerklärung</span>
|
||||
<span>📖 Quantitative Handbook</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -630,7 +629,7 @@ export default function EventsDemo() {
|
||||
<form onSubmit={handleAddAsset} className="flex items-center gap-1 bg-slate-950 p-1 rounded-lg border border-slate-800">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Ticker (z.B. TSLA)"
|
||||
placeholder="Ticker (e.g. TSLA)"
|
||||
value={newTickerInput}
|
||||
onChange={(e) => setNewTickerInput(e.target.value)}
|
||||
className="bg-transparent text-[11px] text-slate-200 focus:outline-none px-2 py-0.5 w-24 uppercase font-mono"
|
||||
@@ -664,7 +663,7 @@ export default function EventsDemo() {
|
||||
<button
|
||||
onClick={() => handleRemoveAsset(asset.symbol)}
|
||||
className="text-slate-500 hover:text-rose-400 p-0.5 rounded opacity-0 group-hover/header:opacity-100 transition-opacity"
|
||||
title={`${asset.name} Spalte löschen`}
|
||||
title={`${asset.name} Column delete`}
|
||||
>
|
||||
<Trash2 className="w-3 h-3" />
|
||||
</button>
|
||||
@@ -687,7 +686,7 @@ export default function EventsDemo() {
|
||||
<td className="py-3 px-3 text-slate-400 font-mono">
|
||||
{ev.date}
|
||||
<span className="block text-[10px] text-slate-500">
|
||||
{d === 0 ? 'Heute' : d > 0 ? `In ${d} Tagen` : `Vor ${-d} Tagen`}
|
||||
{d === 0 ? 'Today' : d > 0 ? `In ${d} days` : `${-d} days ago`}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@@ -750,7 +749,7 @@ export default function EventsDemo() {
|
||||
<button
|
||||
onClick={() => deleteEventFromMatrix(ev.id)}
|
||||
className="text-slate-500 hover:text-rose-400 p-1 hover:bg-slate-800/50 rounded transition-all"
|
||||
title="Event aus Matrix löschen"
|
||||
title="Delete event from matrix"
|
||||
>
|
||||
<Trash2 className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
@@ -1082,7 +1081,7 @@ export default function EventsDemo() {
|
||||
|
||||
{calibrationSuccess && (
|
||||
<div className="bg-emerald-950/30 border border-emerald-800/80 text-emerald-400 text-[10px] rounded-lg p-2 flex items-center gap-1.5 justify-center font-semibold">
|
||||
<Check className="w-3.5 h-3.5" /> Kalibrierung erfolgreich abgeschlossen!
|
||||
<Check className="w-3.5 h-3.5" /> Calibration successfully completed!
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1101,7 +1100,7 @@ export default function EventsDemo() {
|
||||
|
||||
{lastCalibrationTime && (
|
||||
<div className="text-[9px] text-slate-500 font-mono">
|
||||
Letzter Durchlauf: {lastCalibrationTime} ({lmmObservations.length} Obs.)
|
||||
Last run: {lastCalibrationTime} ({lmmObservations.length} Obs.)
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -1169,7 +1168,7 @@ export default function EventsDemo() {
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<label className="block text-slate-500 mb-1 text-[10px] uppercase font-semibold">Fokus Asset</label>
|
||||
<label className="block text-slate-500 mb-1 text-[10px] uppercase font-semibold">Focus Asset</label>
|
||||
<select
|
||||
value={selectedSurvivalAsset}
|
||||
onChange={(e) => setSelectedSurvivalAsset(e.target.value)}
|
||||
@@ -1184,7 +1183,7 @@ export default function EventsDemo() {
|
||||
<div className="grid grid-cols-2 gap-3 mt-2">
|
||||
<div className="bg-slate-950/40 border border-slate-805 p-3 rounded-xl">
|
||||
<span className="block text-[10px] text-slate-500 uppercase font-semibold">Right Censoring</span>
|
||||
<span className="text-sm font-bold text-slate-200 font-mono">30 Tage</span>
|
||||
<span className="text-sm font-bold text-slate-200 font-mono">30 days</span>
|
||||
</div>
|
||||
<div className="bg-slate-950/40 border border-slate-805 p-3 rounded-xl">
|
||||
<span className="block text-[10px] text-slate-500 uppercase font-semibold">Observation Count</span>
|
||||
@@ -1226,7 +1225,7 @@ export default function EventsDemo() {
|
||||
{selectedModel === 'ROC' && (
|
||||
<div className="w-full h-full">
|
||||
<div className="text-[10px] font-mono text-slate-400 mb-2 text-center flex items-center justify-center gap-1.5">
|
||||
<span>Modell-Klassifikationstrennung (FPR vs TPR)</span>
|
||||
<span>Model Classification Separation (FPR vs TPR)</span>
|
||||
</div>
|
||||
<ResponsiveContainer width="100%" height="90%">
|
||||
<AreaChart data={rocData} margin={{ top: 10, right: 10, left: -25, bottom: 5 }}>
|
||||
|
||||
Reference in New Issue
Block a user