private async executeLiveTrade(decision: any): Promise { try { console.log(`🚀 Executing DRIFT trade: ${decision.direction} ${decision.positionSize} ${this.config!.symbol} with ${this.config!.maxLeverage}x leverage`) const response = await fetch('http://localhost:3000/api/automation/trade', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ dexProvider: 'DRIFT', action: decision.direction.toLowerCase() === 'buy' ? 'open_long' : 'open_short', symbol: this.config!.symbol.replace('USD', ''), // Convert SOLUSD to SOL amount: this.config!.tradingAmount, side: decision.direction, leverage: this.config!.maxLeverage, stopLoss: decision.stopLoss, takeProfit: decision.takeProfit, mode: 'LIVE' }) }) if (!response.ok) { throw new Error(`Drift trade request failed: ${response.statusText}`) } const result = await response.json() if (result.success) { return { transactionId: result.result?.transactionId || result.txId, executionPrice: result.result?.executionPrice || decision.currentPrice, amount: result.result?.amount || decision.positionSize, direction: decision.direction, status: 'COMPLETED', timestamp: new Date(), fees: result.result?.fees || 0, slippage: result.result?.slippage || 0, leverage: this.config!.maxLeverage, dexProvider: 'DRIFT', tradingAmount: this.config!.tradingAmount } } else { throw new Error(result.error || 'Drift trade execution failed') } } catch (error) { console.error('Live trade execution error:', error) throw error } }