From b94a7fcdd87d22f9986cc8d050503cec66c31aaf Mon Sep 17 00:00:00 2001 From: Antigravity Agent Date: Fri, 12 Jun 2026 21:24:01 +0200 Subject: [PATCH] Closes #011 - Refactor Smart Money tab and extend DEV_MODE shield --- DEV_LOG.md | 16 +++ QUANT_ROADMAP.md | 5 +- app/api/insider/route.ts | 138 +++++++++++++++++++++ app/page.tsx | 38 ++++-- components/modules/insider/InsiderDemo.tsx | 17 ++- 5 files changed, 197 insertions(+), 17 deletions(-) diff --git a/DEV_LOG.md b/DEV_LOG.md index 946adb6..ec37487 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -73,5 +73,21 @@ 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-12] - Smart-Money Refactoring, Visual Consolidation & Security Shield (#ISSUE-011) + +### Added +* **Insider API Outbound Interception Layer**: Configured [/api/insider/route.ts](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/app/api/insider/route.ts) to intercept requests when `process.env.DEV_MODE === 'true'`, short-circuiting live FMP calls and returning high-fidelity mock streams with `isShieldActive: true`. +* **Insider UI Workstation badge**: Upgraded [InsiderDemo.tsx](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/components/modules/insider/InsiderDemo.tsx) to read the shield state and render the glowing amber status badge `🟡 DEV-ARCHIV AKTIV (0 CALLS)` when active. + +### Modified +* **`app/page.tsx`**: Consolidated the separate `Insider` and `Whale Screener` tabs under a single `Smart Money` tab (activeTab `'smart-money'`). Implemented an interactive sub-tab selector toggle in the layout switcher. Removed bracket labels from the `⚡ AI Special Silo` navigation button. +* **`QUANT_ROADMAP.md`**: Updated Section 1 and Section 3 to document the Smart Money visual consolidation. + +### 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 65fd3f6..458a0f5 100644 --- a/QUANT_ROADMAP.md +++ b/QUANT_ROADMAP.md @@ -17,8 +17,8 @@ This document serves as the permanent, centralized system architecture design an * **Phase 3.0: Real FRED Macro Ingestion** * *Features*: Real-time server-side API integration with Federal Reserve Economic Data (FRED). Ingests Personal Savings Rates, Credit Card Delinquencies, Housing Starts, and Case-Shiller indices. * *Status*: **Fully Operational (Production Lock)**. -* **Phase 3.0: Whale Satellite-Screener** - * *Features*: Track high-conviction institutional shifts (SEC Form 13F filings) for Scion (Michael Burry), Akre Capital, and Mairs & Power. Calculates Velocity of Conviction (VoC) weight deltas, integrated with `DEV_MODE` offline protection shield. +* **Phase 3.0: Smart Money & Whale Satellite-Screener** + * *Features*: Track high-conviction institutional shifts (SEC Form 13F filings) for Scion (Michael Burry), Akre Capital, and Mairs & Power. Calculates Velocity of Conviction (VoC) weight deltas, integrated with `DEV_MODE` offline protection shield. Consolidated under the unified 'Smart Money' workstation with a sub-tab switcher alongside broad corporate and congressional flows. * *Status*: **Fully Operational (Production Lock)**. * **Phase 4.7: AI & Tech Hyper-Leverage Silo** * *Features*: Track the AI CapEx-Overinvestment Cycle for NVDA, MSFT, GOOGL, META, and AMD. Calculates ROI-to-CapEx (Monetization Gap), Nvidia Supply-Chain Velocity Index, and Tech Infrastructure Leverage with a 60-minute caching layer. @@ -97,6 +97,7 @@ graph TD ### Implemented Architecture - **API Endpoint**: [/api/whale/screener](file:///c:/Users/jannr/.gemini/antigravity/scratch/investment-sandbox/app/api/whale/screener/route.ts) fetches SEC Form 13F filings for Scion Asset Management (Michael Burry: `0001649339`), Akre Capital Management (`0001483348`), and Mairs & Power Small Cap Fund (`0001099684`). - **Offline Fallback**: Respects `DEV_MODE=true` environment configurations, completely bypassing outbound FMP requests and serving structured `MOCK_WHALE_DATA` with `isShieldActive: true`. +- **Visual Interface**: Consolidated under the 'Smart Money' tab (`app/page.tsx`) with a sub-tab selection toggle to switch between broad corporate/congressional flows and whale conviction screeners. - **Velocity of Conviction**: $$\text{VoC}_i = w_{i, t} - w_{i, t-1}$$ $$w_{i, t} = \frac{V_{i, t}}{\sum_{j} V_{j, t}} \times 100$$ diff --git a/app/api/insider/route.ts b/app/api/insider/route.ts index 3483b0d..315604b 100644 --- a/app/api/insider/route.ts +++ b/app/api/insider/route.ts @@ -2,6 +2,128 @@ import { NextResponse } from 'next/server'; export const dynamic = 'force-dynamic'; +const MOCK_EXECUTIVES = [ + { + id: 'mock_exec_1', + ticker: 'PLTR', + insiderName: 'Karp Alexander C.', + relation: 'CEO / Director', + type: 'SELL', + shares: 250000, + value: 9250000, + date: '2026-06-10', + insight: 'Verkauf durch CEO/CFO. Häufig automatisiert (10b5-1 Plan) zur Portfoliodiversifikation.' + }, + { + id: 'mock_exec_2', + ticker: 'NVDA', + insiderName: 'Huang Jen Hsun', + relation: 'CEO / President', + type: 'SELL', + shares: 120000, + value: 15400000, + date: '2026-06-09', + insight: 'Regulärer Verkauf im Rahmen eines vorab festgelegten 10b5-1 Handelsplans.' + }, + { + id: 'mock_exec_3', + ticker: 'AAPL', + insiderName: 'Maestri Luca', + relation: 'CFO / Senior VP', + type: 'BUY', + shares: 15000, + value: 2850000, + date: '2026-06-08', + insight: 'Starkes Conviction-Signal: CFO kauft eigene Aktien aus freien Mitteln.' + }, + { + id: 'mock_exec_4', + ticker: 'TSLA', + insiderName: 'Taneja Vaibhav', + relation: 'Chief Accounting Officer', + type: 'BUY', + shares: 5000, + value: 950000, + date: '2026-06-07', + insight: 'Opportunistischer Conviction-Kauf mit positivem Signal für den Markt.' + } +]; + +const MOCK_CONGRESS = [ + { + id: 'mock_cong_1', + ticker: 'MSFT', + representative: 'Nancy Pelosi', + chamber: 'HOUSE', + type: 'BUY', + valueRange: '$1,000,001 - $5,000,000', + transactionDate: '2026-05-20', + filingDate: '2026-06-05', + lagDays: 16, + insight: 'Politisches Conviction-Signal (Nancy Pelosi). Möglicher Informationsvorsprung.' + }, + { + id: 'mock_cong_2', + ticker: 'NVIDIA', + representative: 'Tommy Tuberville', + chamber: 'SENATE', + type: 'SELL', + valueRange: '$100,001 - $250,000', + transactionDate: '2026-05-15', + filingDate: '2026-06-02', + lagDays: 18, + insight: 'Taktische Reduzierung der Position im Rahmen von Compliance-Richtlinien.' + }, + { + id: 'mock_cong_3', + ticker: 'LMT', + representative: 'Mark Green', + chamber: 'HOUSE', + type: 'BUY', + valueRange: '$50,001 - $100,000', + transactionDate: '2026-05-18', + filingDate: '2026-06-01', + lagDays: 14, + insight: 'Akkumulation im Rüstungssektor. Zeitliche Nähe zu Haushaltsbeschlüssen.' + } +]; + +const MOCK_WHALES = [ + { + id: 'mock_whale_1', + ticker: 'AMZN', + institution: 'Scion Asset Management (Michael Burry)', + type: 'BUY', + sharesTraded: 50000, + sharesHeld: 150000, + filingDate: '2026-05-15', + estimatedValue: 9150000, + insight: 'Institutionelle Akkumulation durch Scion Asset Management. Aufbau einer strategischen Position.' + }, + { + id: 'mock_whale_2', + ticker: 'GOOGL', + institution: 'Akre Capital Management', + type: 'BUY', + sharesTraded: 250000, + sharesHeld: 1250000, + filingDate: '2026-05-15', + estimatedValue: 43250000, + insight: 'Aufbau/Verstärkung einer langfristigen Kernposition durch Akre Capital.' + }, + { + id: 'mock_whale_3', + ticker: 'TSLA', + institution: 'Renaissance Technologies LLC', + type: 'SELL', + sharesTraded: 450000, + sharesHeld: 2100000, + filingDate: '2026-05-14', + estimatedValue: 85500000, + insight: 'Taktische Gewinnmitnahme / Quantitative Portfolio-Rebalancierung.' + } +]; + function getStrategicInsight(trade: { type: string; relation: string; value: number; ticker: string }) { const isBuy = trade.type === 'BUY'; const relation = (trade.relation || '').toUpperCase(); @@ -42,6 +164,22 @@ export async function GET(request: Request) { const { searchParams } = new URL(request.url); const type = searchParams.get('type') || 'executives'; const apiKey = process.env.FMP_API_KEY; + const isDevMode = process.env.DEV_MODE === 'true'; + + if (isDevMode) { + let mockResults: any[] = []; + if (type === 'executives') mockResults = MOCK_EXECUTIVES; + else if (type === 'congress') mockResults = MOCK_CONGRESS; + else if (type === 'whales') mockResults = MOCK_WHALES; + + const res = NextResponse.json( + { results: mockResults, liveDataAvailable: false, isShieldActive: true }, + { status: 200 } + ); + res.headers.set('Cache-Control', 'no-store, max-age=0, must-revalidate'); + res.headers.set('X-Shield-Active', 'true'); + return res; + } if (!apiKey) { console.error("====== CRITICAL INSIDER ROUTE FAILURE ======", new Error("FMP_API_KEY is not configured in environment variables.")); diff --git a/app/page.tsx b/app/page.tsx index 923d55d..e878e9e 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -12,7 +12,8 @@ import WhaleScreener from '@/components/modules/whale/WhaleScreener'; import { BarChart3, TrendingUp, ShieldAlert, Radio, Landmark, RefreshCw, Activity, Cpu, Compass } from 'lucide-react'; export default function Home() { - const [activeTab, setActiveTab] = useState<'sandbox' | 'scanner' | 'insider' | 'crypto' | 'events' | 'macro' | 'tech' | 'whale'>('sandbox'); + const [activeTab, setActiveTab] = useState<'sandbox' | 'scanner' | 'smart-money' | 'crypto' | 'events' | 'macro' | 'tech'>('sandbox'); + const [smartMoneySubTab, setSmartMoneySubTab] = useState<'flows' | 'screener'>('flows'); return (
@@ -78,10 +79,10 @@ export default function Home() { Scanner -
@@ -124,12 +119,29 @@ export default function Home() {
{activeTab === 'sandbox' && } {activeTab === 'scanner' && } - {activeTab === 'insider' && } + {activeTab === 'smart-money' && ( +
+
+ + +
+ {smartMoneySubTab === 'flows' ? : } +
+ )} {activeTab === 'crypto' && } {activeTab === 'events' && } {activeTab === 'macro' && } {activeTab === 'tech' && } - {activeTab === 'whale' && }
diff --git a/components/modules/insider/InsiderDemo.tsx b/components/modules/insider/InsiderDemo.tsx index 01b133c..da78100 100644 --- a/components/modules/insider/InsiderDemo.tsx +++ b/components/modules/insider/InsiderDemo.tsx @@ -80,6 +80,7 @@ export default function InsiderDemo() { }[] | null>(null); const [showMathAccordion, setShowMathAccordion] = useState(false); const [isMathModalOpen, setIsMathModalOpen] = useState(false); + const [isShieldActive, setIsShieldActive] = useState(false); const [loading, setLoading] = useState(false); const [errorMsg, setErrorMsg] = useState(null); @@ -105,6 +106,7 @@ export default function InsiderDemo() { }) ]); if (active) { + setIsShieldActive(!!execRes.isShieldActive || !!congRes.isShieldActive || !!whaleRes.isShieldActive); const unavailable: string[] = []; if (execRes.liveDataAvailable === false) unavailable.push('Executives (Form 4)'); if (congRes.liveDataAvailable === false) unavailable.push('Congress (Stock Act)'); @@ -247,8 +249,19 @@ export default function InsiderDemo() {
Element 3 -

- Institutional & Insider Flow Tracker +

+ Institutional & Insider Flow Tracker + {isShieldActive ? ( + + + DEV-ARCHIV AKTIV (0 CALLS) + + ) : ( + + + LIVE-API ENDPUNKT (FMP CORPO) + + )}