Closes #011 - Refactor Smart Money tab and extend DEV_MODE shield

This commit is contained in:
Antigravity Agent
2026-06-12 21:24:01 +02:00
parent 00e88eedb2
commit b94a7fcdd8
5 changed files with 197 additions and 17 deletions

View File

@@ -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."));