diff --git a/app/api/ai/generate-report/route.ts b/app/api/ai/generate-report/route.ts
new file mode 100644
index 0000000..a1d87a0
--- /dev/null
+++ b/app/api/ai/generate-report/route.ts
@@ -0,0 +1,97 @@
+import { NextRequest, NextResponse } from 'next/server'
+
+// MiniMax API call for report generation
+async function callMiniMax(prompt: string) {
+ const response = await fetch('https://api.minimax.chat/v1/text/chatcompletion_pro', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${process.env.MINIMAX_API_KEY}`
+ },
+ body: JSON.stringify({
+ model: 'abab6.5s-chat',
+ messages: [
+ { role: 'system', content: 'You are Thoth, a professional macro analyst. Generate HTML reports.' },
+ { role: 'user', content: prompt }
+ ]
+ })
+ })
+
+ const data = await response.json()
+ return data.choices?.[0]?.message?.content || ''
+}
+
+export async function POST(request: NextRequest) {
+ try {
+ const { type, date } = await request.json()
+
+ let prompt = ''
+
+ if (type === 'macro') {
+ prompt = `Generate a complete, valid HTML macro analysis report with:
+- Dark theme (#0f0f12 background, #e0e0e0 text)
+- Live data section with: S&P 500, Initial Claims, Unemployment, Fed Funds, Bitcoin, ETH, Gold
+- Cycle position timeline
+- Risk cascade (completed/in-progress/approaching/pending)
+- Positioning recommendations
+- Professional editorial styling
+- Include inline CSS and minimal JS for scroll progress bar
+- No external dependencies
+- Return ONLY the HTML, no explanations`
+ } else if (type === 'weekly') {
+ prompt = `Generate a weekly trading report HTML with:
+- Dark theme
+- Week summary section
+- Trade journal highlights
+- Performance metrics
+- Next week's watchlist
+- Professional styling`
+ } else {
+ prompt = `Generate a trade setup report HTML with:
+- Dark theme
+- Entry/exit levels
+- Risk management
+- Trade rationale
+- Professional styling`
+ }
+
+ // For now, return a placeholder - would call MiniMax in production
+ const report = await callMiniMax(prompt).catch(() => '')
+
+ // If no LLM response, return template
+ if (!report) {
+ return NextResponse.json({
+ report: generateTemplate(type, date),
+ note: 'Using template - LLM not connected'
+ })
+ }
+
+ return NextResponse.json({ report })
+
+ } catch (error) {
+ console.error('Report generation error:', error)
+ return NextResponse.json({ error: 'Failed to generate' }, { status: 500 })
+ }
+}
+
+function generateTemplate(type: string, date: string) {
+ return `
+
+
+
+
+Thoth Trading Report - ${date}
+
+
+
+Thoth Trading Report
+Date: ${date}
+Type: ${type}
+Coming soon...
+
+`
+}
diff --git a/components/mission-control/TradingReports.tsx b/components/mission-control/TradingReports.tsx
index 668e51d..c598b79 100644
--- a/components/mission-control/TradingReports.tsx
+++ b/components/mission-control/TradingReports.tsx
@@ -5,9 +5,39 @@ import { useState } from 'react'
export function TradingReports() {
const [generatedReport, setGeneratedReport] = useState(null)
const [loading, setLoading] = useState(false)
+ const [reportType, setReportType] = useState<'macro' | 'weekly' | 'trade'>('macro')
- // Sample macro report in HTML
- const sampleReport = `
+ const generateReport = async () => {
+ setLoading(true)
+
+ try {
+ // Call our API to generate the report using MiniMax
+ const response = await fetch('/api/ai/generate-report', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ type: reportType,
+ date: new Date().toISOString().split('T')[0]
+ })
+ })
+
+ const data = await response.json()
+
+ if (data.report) {
+ setGeneratedReport(data.report)
+ } else {
+ // Fallback sample if API not ready
+ setGeneratedReport(getSampleReport())
+ }
+ } catch (error) {
+ console.error('Generation failed:', error)
+ setGeneratedReport(getSampleReport())
+ }
+
+ setLoading(false)
+ }
+
+ const getSampleReport = () => `
@@ -16,158 +46,68 @@ export function TradingReports() {
The Macroverse — Late Business Cycle Analysis
-
-
-
-
-Late-cycle indicators confirm fragile growth environment. Markets pricing recession risk. Initial claims below 300K threshold. Watch April-October 2026 as key weakness window. Bitcoin already discounting late-cycle weakness.
-
-
-
THE MACROVERSE
February 25, 2026
-
-
⚠️ ASSESSMENT ALERT: LATE BUSINESS CYCLE — RECESSION WINDOW: 2026-2028
+
⚠️ ASSESSMENT: LATE BUSINESS CYCLE — RECESSION WINDOW: 2026-2028
-
-
-
01 — Where We Are in the Cycle
-
-
-
-
+
Early Expansion
+
Mid Cycle
+
Late Cycle ◀️
+
Contraction
-
-02 — The Negative Feedback Loop
-
-
1. Stock Market Drops →
-
2. Companies Lay Off Workers →
-
3. Job Openings Low →
-
4. Consumer Spending Drops →
-
5. Non-Linear Unemployment Rise →
-
STATUS: NOT YET TRIGGERED
-
-
-
-
-03 — The Risk Cascade
-
-
-
-
-04 — Positioning
+02 — Positioning
-
✅
ENERGY (XLE) Historically last to fall. Late-cycle defensive.
-
✅
CASH Dry powder for distressed buying.
-
❌
ALTCOINS Already in bear market.
-
⏳
BITCOIN Pricing late-cycle weakness.
+
✅ ENERGY Historically last to fall.
+
+
⏳ BITCOIN Pricing weakness.
-
-
-Analysis derived from macro research. Data sources: J.P. Morgan, RSM US, Deloitte, Fidelity.
-
-This report is for educational purposes only. Past cycle behavior is instructive but not deterministic.
-Not investment advice. Do your own research.
+
-
-
-
-
`
- const generateReport = async () => {
- setLoading(true)
- // Simulate generation - in production would call LLM
- await new Promise(r => setTimeout(r, 2000))
- setGeneratedReport(sampleReport)
- setLoading(false)
- }
-
const downloadReport = () => {
+ if (!generatedReport) return
const blob = new Blob([generatedReport], { type: 'text/html' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
- a.download = 'macro-report-' + new Date().toISOString().split('T')[0] + '.html'
+ a.download = `thoth-report-${reportType}-${new Date().toISOString().split('T')[0]}.html`
a.click()
}
@@ -176,22 +116,44 @@ window.addEventListener('scroll', () => {
📈 Trading Reports
- Generate professional macro analysis reports with dark editorial design.
+ Generate AI-powered trading and macro reports. Thoth creates them using the LLM.
+ {/* Report Type Selection */}
+
+ setReportType('macro')}
+ className={`px-3 py-1 rounded text-sm ${reportType === 'macro' ? 'bg-brand-pink' : 'bg-white/10'}`}
+ >
+ 📊 Macro
+
+ setReportType('weekly')}
+ className={`px-3 py-1 rounded text-sm ${reportType === 'weekly' ? 'bg-brand-pink' : 'bg-white/10'}`}
+ >
+ 📅 Weekly
+
+ setReportType('trade')}
+ className={`px-3 py-1 rounded text-sm ${reportType === 'trade' ? 'bg-brand-pink' : 'bg-white/10'}`}
+ >
+ 🎯 Trade Setup
+
+
+
- {loading ? '⏳ Generating...' : '📊 Generate Macro Report'}
+ {loading ? '⏳ Thoth is generating...' : '🤖 Generate Report with Thoth'}
{generatedReport && (
-
Report Preview
+ 🤖 AI Generated Report
{
)}