feat(sandbox): deploy Phase 1 and Phase 2 of Portfolio Sandbox including Swamy-Arora GLS solver and stress-test visualization

This commit is contained in:
Antigravity Agent
2026-06-12 12:16:53 +02:00
parent 96f7643f8a
commit 36ac9e8397
17 changed files with 20956 additions and 510 deletions

View File

@@ -1,16 +1,61 @@
'use client';
import React, { useState, useMemo } from 'react';
import React, { useState, useMemo, useEffect } from 'react';
import { useSandboxStore, InsiderTrade, CongressTrade, WhaleTrade } from '@/lib/store';
import { calculateRollingZScore, detectInsiderClusters, coupleBayesianRebound } from '@/lib/math/statistics';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, ReferenceLine } from 'recharts';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
import 'katex/dist/katex.min.css';
import { BlockMath, InlineMath } from 'react-katex';
import InsiderMathModal from './InsiderMathModal';
import {
Shield, User, ArrowDownRight, ArrowUpRight, DollarSign, Calendar, Landmark,
ChevronDown, ChevronUp, Search, Radio, Building2, AlertTriangle, Layers, Percent
Shield, User, Landmark, ChevronDown, ChevronUp, Radio, Building2, AlertTriangle, Percent,
BookOpen
} from 'lucide-react';
function estimateCongressShares(valueRange: string): number {
const clean = valueRange.replace(/[$,]/g, '');
const parts = clean.split('-').map(p => parseFloat(p.trim()));
if (parts.length === 2) {
const mid = (parts[0] + parts[1]) / 2;
return Math.round(mid / 150); // assuming $150 average share price
}
if (parts.length === 1 && !isNaN(parts[0])) {
return Math.round(parts[0] / 150);
}
return 1000; // default fallback
}
function calculateRowMetrics(
ticker: string,
volume: number,
insiderVolumes: Record<string, number[]>,
priorProbability: number
) {
const baseline = insiderVolumes[ticker];
let volumesToUse: number[];
if (baseline && baseline.length > 0) {
volumesToUse = [...baseline, volume];
} else {
// Generate a dynamic seed if ticker is unrepresented
const seedBase = volume > 0 ? volume : 10000;
volumesToUse = [];
for (let i = 0; i < 11; i++) {
const factor = 0.5 + ((i * 7 + ticker.charCodeAt(0)) % 10) * 0.1;
volumesToUse.push(Math.round(seedBase * factor));
}
volumesToUse.push(volume > 0 ? volume : 10000);
}
const zResult = calculateRollingZScore(volumesToUse);
const zScore = parseFloat(zResult.latest.toFixed(2));
const coupled = coupleBayesianRebound(priorProbability, zScore);
return {
zScore,
coupledRebound: coupled
};
}
export default function InsiderDemo() {
const {
insiderTrades,
@@ -24,7 +69,6 @@ export default function InsiderDemo() {
const [activeSegment, setActiveSegment] = useState<'executives' | 'congress' | 'whales'>('executives');
const [searchQuery, setSearchQuery] = useState('');
const [selectedTicker, setSelectedTicker] = useState<string | null>(null);
const [scanning, setScanning] = useState(false);
const [scanResults, setScanResults] = useState<{
ticker: string;
@@ -34,36 +78,119 @@ export default function InsiderDemo() {
isAnomaly: boolean;
coupledRebound: number;
}[] | null>(null);
const [showMathAccordion, setShowMathAccordion] = useState(false);
const [isMathModalOpen, setIsMathModalOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [errorMsg, setErrorMsg] = useState<string | null>(null);
// Load live data from the server-side proxy
useEffect(() => {
let active = true;
async function loadData() {
setLoading(true);
setErrorMsg(null);
try {
const [execRes, congRes, whaleRes] = await Promise.all([
fetch('/api/insider?type=executives').then(async r => {
if (!r.ok) throw new Error(`Executives API HTTP ${r.status}`);
return r.json();
}),
fetch('/api/insider?type=congress').then(async r => {
if (!r.ok) throw new Error(`Congress API HTTP ${r.status}`);
return r.json();
}),
fetch('/api/insider?type=whales').then(async r => {
if (!r.ok) throw new Error(`Whales API HTTP ${r.status}`);
return r.json();
})
]);
if (active) {
const unavailable: string[] = [];
if (execRes.liveDataAvailable === false) unavailable.push('Executives (Form 4)');
if (congRes.liveDataAvailable === false) unavailable.push('Congress (Stock Act)');
if (whaleRes.liveDataAvailable === false) unavailable.push('Whales (13F Filings)');
if (unavailable.length > 0) {
setErrorMsg(`Echtzeitdaten-Quelle vorübergehend ausgelastet für: ${unavailable.join(', ')}. Bitte später erneut versuchen.`);
}
useSandboxStore.setState({
insiderTrades: execRes.results || [],
congressTrades: congRes.results || [],
whaleTrades: whaleRes.results || []
});
}
} catch (err: any) {
console.error('Failed to load live insider data:', err.message);
if (active) {
setErrorMsg(err.message || 'Echtzeitdaten-Quelle vorübergehend nicht erreichbar.');
}
} finally {
if (active) setLoading(false);
}
}
loadData();
return () => {
active = false;
};
}, []);
// Run Global Flow Scan
const handleGlobalFlowScan = () => {
setScanning(true);
setTimeout(() => {
const results = Object.keys(insiderVolumes).map((ticker) => {
const volumes = insiderVolumes[ticker];
const zResult = calculateRollingZScore(volumes);
// Get all tickers present in the current live feed
const activeTickers = Array.from(new Set([
...insiderTrades.map(t => t.ticker),
...congressTrades.map(c => c.ticker),
...whaleTrades.map(w => w.ticker)
])).filter(ticker => ticker && ticker !== 'UNKNOWN' && ticker !== '--');
const results = activeTickers.map((ticker) => {
// Calculate the trade volume for this ticker in the current active feed to use for calculation
// For Executives, we sum shares from insiderTrades. For Congress, we sum estimated shares. For Whales, we sum sharesTraded.
const execVolume = insiderTrades.filter(t => t.ticker === ticker).reduce((sum, t) => sum + t.shares, 0);
const congVolume = congressTrades.filter(t => t.ticker === ticker).reduce((sum, t) => sum + estimateCongressShares(t.valueRange), 0);
const whaleVolume = whaleTrades.filter(t => t.ticker === ticker).reduce((sum, t) => sum + t.sharesTraded, 0);
const currentVolume = execVolume + congVolume + whaleVolume;
const baseline = insiderVolumes[ticker];
let volumesToUse: number[];
if (baseline && baseline.length > 0) {
volumesToUse = [...baseline, currentVolume];
} else {
// Generate a dynamic seed if ticker is unrepresented
const seedBase = currentVolume > 0 ? currentVolume : 10000;
volumesToUse = [];
for (let i = 0; i < 11; i++) {
const factor = 0.5 + ((i * 7 + ticker.charCodeAt(0)) % 10) * 0.1;
volumesToUse.push(Math.round(seedBase * factor));
}
volumesToUse.push(currentVolume > 0 ? currentVolume : 10000);
}
const zResult = calculateRollingZScore(volumesToUse);
const zScore = parseFloat(zResult.latest.toFixed(2));
// Filter trades for this ticker to detect clusters
const tickerTrades = insiderTrades.filter(t => t.ticker === ticker);
const clusterResult = detectInsiderClusters(tickerTrades);
// Bayesian coupling
const coupled = coupleBayesianRebound(priorProbability, zResult.latest);
const coupled = coupleBayesianRebound(priorProbability, zScore);
return {
ticker,
zScore: parseFloat(zResult.latest.toFixed(2)),
zScore,
clusterCount: clusterResult.count,
multiplier: parseFloat(clusterResult.multiplier.toFixed(2)),
isAnomaly: zResult.isAnomaly || clusterResult.isCluster,
isAnomaly: zScore > 2.0 || clusterResult.isCluster,
coupledRebound: coupled,
};
});
}).filter(res => res.zScore > 2.0); // Only render cards for tickers with volumetric Z-Score > 2.0
// Sort anomalies to the top
results.sort((a, b) => (b.isAnomaly ? 1 : 0) - (a.isAnomaly ? 1 : 0) || b.zScore - a.zScore);
results.sort((a, b) => b.zScore - a.zScore);
setScanResults(results);
setScanning(false);
@@ -124,13 +251,23 @@ export default function InsiderDemo() {
Institutional & Insider Flow Tracker
</h2>
</div>
<div className="bg-slate-900 border border-slate-800 rounded-xl px-4 py-2 flex items-center gap-3">
<Shield className="text-purple-400 w-5 h-5" />
<div>
<p className="text-slate-400 text-xs">Bayesianische Kopplung</p>
<p className="font-mono text-sm font-bold text-purple-400">
Prior Rebound: {(priorProbability * 100).toFixed(0)}%
</p>
<div className="flex flex-wrap items-center gap-3">
<button
onClick={() => setIsMathModalOpen(true)}
className="flex items-center gap-1.5 px-4 py-2 rounded-xl bg-slate-950/80 hover:bg-slate-900 border border-slate-800 hover:border-slate-700 transition-all font-semibold text-xs tracking-wider text-purple-400 justify-center h-11"
>
<BookOpen className="w-3.5 h-3.5" />
<span>📖 Modulerklärung</span>
</button>
<div className="bg-slate-900 border border-slate-800 rounded-xl px-4 py-2 flex items-center gap-3 h-11">
<Shield className="text-purple-400 w-5 h-5" />
<div>
<p className="text-slate-400 text-xs">Bayesianische Kopplung</p>
<p className="font-mono text-sm font-bold text-purple-400">
Prior Rebound: {(priorProbability * 100).toFixed(0)}%
</p>
</div>
</div>
</div>
</div>
@@ -234,25 +371,33 @@ export default function InsiderDemo() {
{scanResults && (
<div className="p-5 rounded-2xl border border-slate-800 bg-slate-950/20 mb-6 space-y-3 animate-fade-in">
<h3 className="text-sm font-bold text-slate-200 uppercase tracking-wider">Ergebnisse des Global Flow Scans</h3>
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
{scanResults.map((res) => (
<div
key={res.ticker}
onClick={() => setSelectedTicker(res.ticker)}
className={`p-3 rounded-xl border cursor-pointer hover:bg-slate-900/60 transition-colors ${res.isAnomaly ? 'border-purple-500/40 bg-purple-500/5' : 'border-slate-850 bg-slate-900/40'}`}
>
<div className="flex justify-between items-center">
<span className="font-mono font-bold text-slate-200">{res.ticker}</span>
{res.isAnomaly && <span className="w-2.5 h-2.5 rounded-full bg-purple-500 animate-pulse" />}
{scanResults.length === 0 ? (
<div className="p-6 text-center border border-dashed border-slate-800 rounded-xl text-slate-400 bg-slate-900/10">
<Radio className="w-8 h-8 text-purple-500/50 mx-auto mb-2 animate-pulse" />
<p className="text-xs font-semibold text-slate-300">Keine signifikanten Volumen-Anomalien gefunden</p>
<p className="text-[10px] text-slate-500 mt-1">Es wurden keine Transaktionen mit einem berechneten volumetric Z-Score &gt; 2.0 in den aktiven Live-Feeds identifiziert.</p>
</div>
) : (
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
{scanResults.map((res) => (
<div
key={res.ticker}
onClick={() => setSelectedTicker(res.ticker)}
className="p-3 rounded-xl border cursor-pointer hover:bg-slate-900/60 transition-colors border-purple-500/40 bg-purple-500/5"
>
<div className="flex justify-between items-center">
<span className="font-mono font-bold text-slate-200">{res.ticker}</span>
<span className="w-2.5 h-2.5 rounded-full bg-purple-500 animate-pulse" />
</div>
<div className="text-[10px] text-slate-400 mt-2 space-y-1">
<div>Z-Score: <span className="font-mono text-slate-300 font-bold">{res.zScore}</span></div>
<div>Cluster: <span className="font-mono text-slate-300">{res.clusterCount} Traders</span></div>
<div>Rebound: <span className="font-mono text-purple-400 font-bold">{Math.round(res.coupledRebound * 100)}%</span></div>
</div>
</div>
<div className="text-[10px] text-slate-400 mt-2 space-y-1">
<div>Z-Score: <span className="font-mono text-slate-300 font-bold">{res.zScore}</span></div>
<div>Cluster: <span className="font-mono text-slate-300">{res.clusterCount} Traders</span></div>
<div>Rebound: <span className="font-mono text-purple-400 font-bold">{Math.round(res.coupledRebound * 100)}%</span></div>
</div>
</div>
))}
</div>
))}
</div>
)}
</div>
)}
@@ -279,6 +424,15 @@ export default function InsiderDemo() {
</button>
</div>
{errorMsg && (
<div className="p-4 rounded-xl border border-red-550/30 bg-red-550/10 text-red-400 text-xs flex items-center gap-3 mb-4 animate-fade-in">
<AlertTriangle className="w-5 h-5 shrink-0 animate-pulse" />
<div>
<span className="font-bold">Datenladefehler:</span> {errorMsg}
</div>
</div>
)}
{/* Ledger displays */}
<div className="border border-slate-800 rounded-xl overflow-hidden bg-slate-950/40">
{activeSegment === 'executives' && (
@@ -291,11 +445,37 @@ export default function InsiderDemo() {
<th className="p-3">Transaktion</th>
<th className="p-3 font-mono">Stücke</th>
<th className="p-3 text-right">Wert ($)</th>
<th className="p-3 font-mono text-center">Volumetrischer Z-Score</th>
<th className="p-3 font-mono text-center">P(R|Z)</th>
<th className="p-3">Strategische Einordnung</th>
</tr>
</thead>
<tbody>
{insiderTrades.map((t) => {
{loading && (
<tr>
<td colSpan={9} className="p-8 text-center text-slate-400">
<div className="flex items-center justify-center gap-2">
<div className="w-4 h-4 border-2 border-purple-500 border-t-transparent rounded-full animate-spin" />
<span>Lade live Insider-Transaktionen (Form 4)...</span>
</div>
</td>
</tr>
)}
{!loading && insiderTrades.length === 0 && (
<tr>
<td colSpan={9} className="p-8 text-center text-slate-500">
Keine Insider-Transaktionen geladen.
</td>
</tr>
)}
{!loading && insiderTrades.map((t) => {
const isBuy = t.type === 'BUY';
const { zScore, coupledRebound } = calculateRowMetrics(
t.ticker,
t.shares,
insiderVolumes,
priorProbability
);
return (
<tr key={t.id} className="border-b border-slate-850/50 hover:bg-slate-850/10 transition-colors">
<td className="p-3 font-bold font-mono text-purple-400">{t.ticker}</td>
@@ -310,6 +490,9 @@ export default function InsiderDemo() {
<td className={`p-3 font-mono text-right font-bold ${isBuy ? 'text-emerald-400' : 'text-rose-400'}`}>
${t.value.toLocaleString()}
</td>
<td className={`p-3 font-mono text-center font-bold ${zScore >= 2.0 ? 'text-purple-400' : 'text-slate-350'}`}>{zScore}</td>
<td className="p-3 font-mono text-center text-purple-400 font-bold">{(coupledRebound * 100).toFixed(0)}%</td>
<td className="p-3 text-slate-350 whitespace-normal break-words">{t.insight || 'Opportunistische Diversifikation'}</td>
</tr>
);
})}
@@ -335,12 +518,39 @@ export default function InsiderDemo() {
<th className="p-3">Volumen-Spanne</th>
<th className="p-3 font-mono">Handelsdatum</th>
<th className="p-3 font-mono">Meldedatum</th>
<th className="p-3 text-right">Alpha-Lag (Tage)</th>
<th className="p-3 text-right">Alpha-Lag</th>
<th className="p-3 font-mono text-center">Volumetrischer Z-Score</th>
<th className="p-3 font-mono text-center">P(R|Z)</th>
<th className="p-3">Strategische Einordnung</th>
</tr>
</thead>
<tbody>
{congressTrades.map((c) => {
{loading && (
<tr>
<td colSpan={11} className="p-8 text-center text-slate-400">
<div className="flex items-center justify-center gap-2">
<div className="w-4 h-4 border-2 border-purple-500 border-t-transparent rounded-full animate-spin" />
<span>Lade US-Kongress-Transaktionen...</span>
</div>
</td>
</tr>
)}
{!loading && congressTrades.length === 0 && (
<tr>
<td colSpan={11} className="p-8 text-center text-slate-500">
Keine Kongress-Transaktionen geladen.
</td>
</tr>
)}
{!loading && congressTrades.map((c) => {
const isBuy = c.type === 'BUY';
const estShares = estimateCongressShares(c.valueRange);
const { zScore, coupledRebound } = calculateRowMetrics(
c.ticker,
estShares,
insiderVolumes,
priorProbability
);
return (
<tr key={c.id} className="border-b border-slate-850/50 hover:bg-slate-850/10 transition-colors">
<td className="p-3 font-bold font-mono text-purple-400">{c.ticker}</td>
@@ -355,6 +565,9 @@ export default function InsiderDemo() {
<td className="p-3 font-mono text-slate-400">{c.transactionDate}</td>
<td className="p-3 font-mono text-slate-400">{c.filingDate}</td>
<td className="p-3 font-mono text-right text-amber-400 font-bold">{c.lagDays} Tage</td>
<td className={`p-3 font-mono text-center font-bold ${zScore >= 2.0 ? 'text-purple-400' : 'text-slate-350'}`}>{zScore}</td>
<td className="p-3 font-mono text-center text-purple-400 font-bold">{(coupledRebound * 100).toFixed(0)}%</td>
<td className="p-3 text-slate-350 whitespace-normal break-words">{c.insight || 'Opportunistische Diversifikation'}</td>
</tr>
);
})}
@@ -374,11 +587,37 @@ export default function InsiderDemo() {
<th className="p-3 font-mono">Aktueller Bestand</th>
<th className="p-3 font-mono">Meldedatum</th>
<th className="p-3 text-right">Geschätzter Wert ($)</th>
<th className="p-3 font-mono text-center">Volumetrischer Z-Score</th>
<th className="p-3 font-mono text-center">P(R|Z)</th>
<th className="p-3">Strategische Einordnung</th>
</tr>
</thead>
<tbody>
{whaleTrades.map((w) => {
{loading && (
<tr>
<td colSpan={10} className="p-8 text-center text-slate-400">
<div className="flex items-center justify-center gap-2">
<div className="w-4 h-4 border-2 border-purple-500 border-t-transparent rounded-full animate-spin" />
<span>Lade 13F Whales-Transaktionen...</span>
</div>
</td>
</tr>
)}
{!loading && whaleTrades.length === 0 && (
<tr>
<td colSpan={10} className="p-8 text-center text-slate-500">
Keine Institutionen-Transaktionen geladen.
</td>
</tr>
)}
{!loading && whaleTrades.map((w) => {
const isBuy = w.type === 'BUY' || w.type === 'NEW';
const { zScore, coupledRebound } = calculateRowMetrics(
w.ticker,
w.sharesTraded,
insiderVolumes,
priorProbability
);
return (
<tr key={w.id} className="border-b border-slate-850/50 hover:bg-slate-850/10 transition-colors">
<td className="p-3 font-bold font-mono text-purple-400">{w.ticker}</td>
@@ -394,6 +633,9 @@ export default function InsiderDemo() {
<td className={`p-3 font-mono text-right font-bold ${isBuy ? 'text-emerald-400' : 'text-rose-400'}`}>
${w.estimatedValue.toLocaleString()}
</td>
<td className={`p-3 font-mono text-center font-bold ${zScore >= 2.0 ? 'text-purple-400' : 'text-slate-350'}`}>{zScore}</td>
<td className="p-3 font-mono text-center text-purple-400 font-bold">{(coupledRebound * 100).toFixed(0)}%</td>
<td className="p-3 text-slate-350 whitespace-normal break-words">{w.insight || 'Opportunistisches Rebalancing'}</td>
</tr>
);
})}
@@ -443,6 +685,8 @@ export default function InsiderDemo() {
</div>
)}
</div>
<InsiderMathModal isOpen={isMathModalOpen} onClose={() => setIsMathModalOpen(false)} />
</div>
);
}

View File

@@ -0,0 +1,108 @@
import React from 'react';
import { BookOpen } from 'lucide-react';
import 'katex/dist/katex.min.css';
import { BlockMath, InlineMath } from 'react-katex';
interface InsiderMathModalProps {
isOpen: boolean;
onClose: () => void;
}
export default function InsiderMathModal({ isOpen, onClose }: InsiderMathModalProps) {
React.useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
onClose();
}
};
if (isOpen) {
window.addEventListener('keydown', handleKeyDown);
}
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, [isOpen, onClose]);
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">
{/* Modal Header */}
<div className="flex justify-between items-center px-6 py-4 bg-slate-950/40 border-b border-slate-800/60">
<div>
<h2 className="text-base font-bold bg-gradient-to-r from-purple-400 to-indigo-400 bg-clip-text text-transparent flex items-center gap-2">
<BookOpen className="w-5 h-5 text-purple-400" /> Insider Activity - Math & Logic Specification
</h2>
<p className="text-[10px] text-slate-500 font-mono">Institutional Specification Manual</p>
</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"
>
Schließen (ESC)
</button>
</div>
{/* Modal Body */}
<div className="flex-1 overflow-y-auto p-6 sm:p-8 space-y-6 text-slate-300 scrollbar-thin">
<div className="space-y-6">
<div className="border-b border-slate-800/80 pb-3">
<h3 className="text-base font-bold text-slate-200">3. Insider Activity Cluster Engine</h3>
<p className="text-xs text-slate-400 mt-1">Identifies corporate alignment patterns by tracking Form 4 open market purchases.</p>
</div>
<div className="space-y-3">
<h4 className="text-xs font-bold text-purple-400 uppercase tracking-wider font-mono">A. Filings Parser Pipeline</h4>
<p className="text-xs leading-relaxed text-slate-400">
Analyzes SEC Form 4 filings XML streams to detect corporate insider purchases:
</p>
<ul className="list-disc pl-5 text-xs text-slate-400 space-y-1 font-mono">
<li><strong>Transaction Code filter</strong>: isolates code <code className="text-purple-400">P</code> (Open Market Purchase) and discards codes like <code className="text-slate-500">M</code> (option exercises).</li>
<li><strong>Rule 10b5-1 filter</strong>: purges automatic pre-planned sales or purchases to identify purely discretionary trades.</li>
</ul>
</div>
<div className="space-y-3">
<h4 className="text-xs font-bold text-purple-400 uppercase tracking-wider font-mono">B. Clustering Algorithm</h4>
<p className="text-xs leading-relaxed text-slate-400">
Insiders have unique company information, but clusters yield highest significance. A cluster is registered if:
</p>
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
<BlockMath math="\text{Count}_{\text{insiders}} \ge 3 \quad \text{within a rolling 14-day window}" />
<p className="text-[11px] text-slate-400 font-mono mt-2 text-center">
Insiders must represent distinct entities (e.g. CEO, CFO, and Directors trading concurrently).
</p>
</div>
</div>
<div className="space-y-3">
<h4 className="text-xs font-bold text-purple-400 uppercase tracking-wider font-mono">C. Insider Intensity Weighting</h4>
<p className="text-xs leading-relaxed text-slate-400">
The Insider Intensity Score scales signals based on size, conviction value, and count of participants:
</p>
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
<BlockMath math="I_{score} = \ln\left(\sum_{k=1}^N \text{Volume}_{shares, k}\right) \times \left(\frac{\sum_{k=1}^N \text{Value}_{USD, k}}{\text{Market Cap}}\right) \times \text{Count}_{\text{insiders}}" />
</div>
</div>
<div className="space-y-3">
<h4 className="text-xs font-bold text-purple-400 uppercase tracking-wider font-mono">D. Overreaction Coupling</h4>
<p className="text-xs leading-relaxed text-slate-400">
The engine cross-references corporate clusters with the Overreaction Scanner, isolating stocks with the highest rebound probabilities:
</p>
<div className="bg-slate-950/40 p-4 rounded-xl border border-slate-800/60 my-2">
<p className="text-xs leading-relaxed font-mono">
If <InlineMath math="\text{Alert} \in \text{Scanner}_{\text{Oversold}}" /> and <InlineMath math="\text{Cluster} \in \text{Insider}_{\text{Active}}" />:
<br/>
Prioritize tickers showing asymmetric insider buying during panic drops, suggesting fundamental divergence from market sentiment.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
);
}