- 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!
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { NextResponse } from 'next/server'
|
|
|
|
export async function GET(request: Request) {
|
|
try {
|
|
const { searchParams } = new URL(request.url);
|
|
const symbol = searchParams.get('symbol');
|
|
|
|
// Get REAL price data from CoinGecko
|
|
let coinGeckoId = 'solana'; // Default
|
|
if (symbol) {
|
|
const symbolMap: { [key: string]: string } = {
|
|
'SOL': 'solana',
|
|
'SOLUSD': 'solana',
|
|
'BTC': 'bitcoin',
|
|
'ETH': 'ethereum'
|
|
};
|
|
coinGeckoId = symbolMap[symbol.toUpperCase()] || 'solana';
|
|
}
|
|
|
|
const response = await fetch(
|
|
`https://api.coingecko.com/api/v3/simple/price?ids=${coinGeckoId}&vs_currencies=usd&include_24hr_change=true&include_market_cap=true&include_24hr_vol=true`
|
|
);
|
|
|
|
if (!response.ok) {
|
|
throw new Error('CoinGecko API failed');
|
|
}
|
|
|
|
const data = await response.json();
|
|
const coinData = data[coinGeckoId];
|
|
|
|
if (!coinData) {
|
|
throw new Error('No price data found');
|
|
}
|
|
|
|
const priceData = {
|
|
symbol: symbol || 'SOL',
|
|
price: coinData.usd,
|
|
change24h: coinData.usd_24h_change || 0,
|
|
volume24h: coinData.usd_24h_vol || 0,
|
|
marketCap: coinData.usd_market_cap || 0,
|
|
lastUpdated: new Date().toISOString(),
|
|
source: 'COINGECKO_API'
|
|
};
|
|
|
|
return NextResponse.json(priceData);
|
|
} catch (error) {
|
|
return NextResponse.json({
|
|
error: 'Failed to fetch prices',
|
|
message: error instanceof Error ? error.message : 'Unknown error'
|
|
}, { status: 500 })
|
|
}
|
|
}
|