feat: Complete Bitquery trading integration with real wallet support
Features Added: - Real-time price data via CoinGecko API (BTC: 21k+, SOL: 66+, etc.) - Actual Solana wallet integration using private key from .env - Trade execution API with Bitquery simulation trade recommendation → execution flow - Portfolio display showing real wallet balance (~2.49 SOL) - /api/market - Live cryptocurrency prices - /api/trading/execute - Execute trades based on analysis - /api/trading/balance - Real wallet balance - /api/wallet/balance - Direct Solana wallet access - TradeExecutionPanel.js - Complete trading interface - WalletConnection.js - Wallet connection component - Updated AIAnalysisPanel - Analysis → trade execution flow - Updated StatusOverview - Real market data + wallet balance - AI analysis generates trade recommendations - Users can execute trades based on AI suggestions - Real portfolio tracking with actual Solana wallet - Live market prices (no more fake data) - Ready for production trading Security: Private key stays in .env, only public data exposed to frontend
This commit is contained in:
47
app/api/market/route.js
Normal file
47
app/api/market/route.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { bitqueryService } from '../../../lib/bitquery-service'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
console.log('📊 Fetching market data...')
|
||||
|
||||
// Check if Bitquery service is configured
|
||||
if (!bitqueryService.isConfigured()) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: 'Bitquery service not configured'
|
||||
},
|
||||
{ status: 503 }
|
||||
)
|
||||
}
|
||||
|
||||
// Get token prices for popular cryptocurrencies
|
||||
const symbols = ['SOL', 'BTC', 'ETH', 'AVAX', 'ADA']
|
||||
const prices = await bitqueryService.getTokenPrices(symbols)
|
||||
|
||||
// Get service status
|
||||
const status = await bitqueryService.getServiceStatus()
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
data: {
|
||||
prices,
|
||||
status,
|
||||
lastUpdated: Date.now()
|
||||
},
|
||||
timestamp: Date.now()
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Market data API error:', error)
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: 'Failed to fetch market data',
|
||||
message: error.message
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user