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:
@@ -48,7 +48,11 @@ interface AnalysisProgress {
|
||||
}
|
||||
}
|
||||
|
||||
export default function AIAnalysisPanel() {
|
||||
interface AIAnalysisPanelProps {
|
||||
onAnalysisComplete?: (analysis: any, symbol: string) => void
|
||||
}
|
||||
|
||||
export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelProps = {}) {
|
||||
const [symbol, setSymbol] = useState('BTCUSD')
|
||||
const [selectedLayouts, setSelectedLayouts] = useState<string[]>(['ai', 'diy']) // Default to both AI and DIY
|
||||
const [selectedTimeframes, setSelectedTimeframes] = useState<string[]>(['60']) // Support multiple timeframes
|
||||
@@ -258,6 +262,11 @@ export default function AIAnalysisPanel() {
|
||||
updateProgress('analysis', 'completed', 'Analysis complete!')
|
||||
|
||||
setResult(data)
|
||||
|
||||
// Call the callback with analysis result if provided
|
||||
if (onAnalysisComplete && data.analysis) {
|
||||
onAnalysisComplete(data.analysis, analysisSymbol)
|
||||
}
|
||||
} else {
|
||||
// Multiple timeframe analysis
|
||||
await new Promise(resolve => setTimeout(resolve, 500))
|
||||
@@ -330,12 +339,22 @@ export default function AIAnalysisPanel() {
|
||||
updateProgress('capture', 'completed', `Captured screenshots for all ${analysisTimeframes.length} timeframes`)
|
||||
updateProgress('analysis', 'completed', `Completed analysis for all timeframes!`)
|
||||
|
||||
setResult({
|
||||
const multiResult = {
|
||||
type: 'multi_timeframe',
|
||||
symbol: analysisSymbol,
|
||||
summary: `Analyzed ${results.length} timeframes for ${analysisSymbol}`,
|
||||
results
|
||||
})
|
||||
}
|
||||
|
||||
setResult(multiResult)
|
||||
|
||||
// Call the callback with the first successful analysis result if provided
|
||||
if (onAnalysisComplete) {
|
||||
const firstSuccessfulResult = results.find(r => r.success && r.result?.analysis)
|
||||
if (firstSuccessfulResult) {
|
||||
onAnalysisComplete(firstSuccessfulResult.result.analysis, analysisSymbol)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
const errorMessage = err instanceof Error ? err.message : 'Failed to perform analysis'
|
||||
|
||||
Reference in New Issue
Block a user