Files
trading_bot_v3/app/api/screenshots/route.js
mindesbunister ab6c4fd861 🔥 OBLITERATE ALL MOCK DATA - System now uses 100% real data sources
- DESTROYED: AI analysis fake 5-second responses → Real TradingView screenshots (30-180s)
- DESTROYED: Mock trading execution → Real Drift Protocol only
- DESTROYED: Fake price data (44.11) → Live CoinGecko API (78.60)
- DESTROYED: Mock balance/portfolio → Real Drift account data
- DESTROYED: Fake screenshot capture → Real enhanced-screenshot service
 Live trading only
- DESTROYED: Hardcoded market data → Real CoinGecko validation
- DESTROYED: Mock chart generation → Real TradingView automation

CRITICAL FIXES:
 AI analysis now takes proper time and analyzes real charts
 Bearish SOL (-0.74%) will now recommend SHORT positions correctly
 All trades execute on real Drift account
 Real-time price feeds from CoinGecko
 Actual technical analysis from live chart patterns
 Database reset with fresh AI learning (18k+ entries cleared)
 Trade confirmation system with ChatGPT integration

NO MORE FAKE DATA - TRADING SYSTEM IS NOW REAL!
2025-07-30 19:10:25 +02:00

86 lines
2.4 KiB
JavaScript

import { NextResponse } from 'next/server'
import fs from 'fs/promises'
import path from 'path'
export async function GET() {
try {
const screenshotsDir = path.join(process.cwd(), 'screenshots')
// Ensure screenshots directory exists
try {
await fs.mkdir(screenshotsDir, { recursive: true })
} catch (error) {
// Directory might already exist
}
// Get list of screenshot files
let files = []
try {
const fileList = await fs.readdir(screenshotsDir)
files = fileList
.filter(file => file.endsWith('.png') || file.endsWith('.jpg'))
.map(file => ({
name: file,
path: `/screenshots/${file}`,
timestamp: Date.now(), // You could get actual file timestamps
type: file.includes('analysis') ? 'analysis' : 'screenshot'
}))
.sort((a, b) => b.timestamp - a.timestamp) // Most recent first
} catch (error) {
console.log('No screenshots directory or empty')
}
return NextResponse.json({
success: true,
screenshots: files,
total: files.length
})
} catch (error) {
console.error('Screenshots API error:', error)
return NextResponse.json({
success: false,
error: 'Failed to get screenshots',
message: error instanceof Error ? error.message : 'Unknown error'
}, { status: 500 })
}
}
export async function POST(request) {
try {
const { symbol, timeframe, analyze } = await request.json();
console.log('📸 Capturing REAL screenshot for:', symbol, timeframe);
// Use the REAL enhanced screenshot service
const enhancedScreenshotService = require('../../../lib/enhanced-screenshot-robust');
const result = await enhancedScreenshotService.captureAndAnalyze({
symbol,
timeframe,
layouts: ['ai', 'diy'],
analyze: analyze !== false
});
if (!result.success) {
throw new Error(result.error || 'Screenshot capture failed');
}
console.log('📸 REAL screenshot captured:', result.screenshots);
return NextResponse.json({
success: true,
screenshots: result.screenshots,
analysis: result.analysis,
source: 'REAL_SCREENSHOT_SERVICE'
});
} catch (error) {
console.error('Error capturing screenshot:', error);
return NextResponse.json({
success: false,
error: error.message
}, { status: 500 });
}
}