Implement pure Drift Protocol automation system
- Remove Jupiter DEX completely from automation system - Implement exclusive Drift Protocol integration with up to 100x leverage - Update executeLiveTrade method to use only Drift API endpoints - Change default DEX provider from Jupiter to Drift - Create minimal professional UI without promotional banners - Add comprehensive leverage options (1x-100x) with risk indicators - Update automation service to route all trades through /api/automation/trade - Fix type definitions to support Drift-only configuration - Add multiple trading pairs support (SOL, BTC, ETH, APT, AVAX, DOGE) - Implement clean configuration interface with essential controls - Remove excessive marketing text and promotional elements - Maintain full automation functionality while simplifying UX
This commit is contained in:
@@ -16,6 +16,7 @@ export interface AutomationConfig {
|
||||
takeProfitPercent: number
|
||||
maxDailyTrades: number
|
||||
riskPercentage: number
|
||||
dexProvider: 'JUPITER' | 'DRIFT'
|
||||
}
|
||||
|
||||
export interface AutomationStatus {
|
||||
@@ -388,13 +389,15 @@ export class AutomationService {
|
||||
leverage
|
||||
})
|
||||
} else {
|
||||
// Execute real trade via Jupiter DEX
|
||||
tradeResult = await jupiterDEXService.executeTrade({
|
||||
// Execute real trade via unified trading endpoint
|
||||
tradeResult = await this.executeUnifiedTrade({
|
||||
symbol: config.symbol,
|
||||
side,
|
||||
amount,
|
||||
stopLoss: analysis.stopLoss?.price,
|
||||
takeProfit: analysis.takeProfits?.tp1?.price
|
||||
takeProfit: analysis.takeProfits?.tp1?.price,
|
||||
leverage,
|
||||
dexProvider: config.dexProvider
|
||||
})
|
||||
}
|
||||
|
||||
@@ -449,6 +452,50 @@ export class AutomationService {
|
||||
}
|
||||
}
|
||||
|
||||
private async executeUnifiedTrade(params: {
|
||||
symbol: string
|
||||
side: string
|
||||
amount: number
|
||||
stopLoss?: number
|
||||
takeProfit?: number
|
||||
leverage?: number
|
||||
dexProvider: 'JUPITER' | 'DRIFT'
|
||||
}): Promise<{ success: boolean; txId?: string }> {
|
||||
try {
|
||||
console.log(`🚀 Executing ${params.dexProvider} trade: ${params.side} ${params.amount} ${params.symbol}`)
|
||||
|
||||
const response = await fetch('http://localhost:3000/api/automation/trade', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
symbol: params.symbol,
|
||||
side: params.side,
|
||||
amount: params.amount,
|
||||
leverage: params.leverage,
|
||||
stopLoss: params.stopLoss,
|
||||
takeProfit: params.takeProfit,
|
||||
dexProvider: params.dexProvider,
|
||||
mode: 'LIVE'
|
||||
})
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Trade request failed: ${response.statusText}`)
|
||||
}
|
||||
|
||||
const result = await response.json()
|
||||
return {
|
||||
success: result.success,
|
||||
txId: result.txId || result.transactionId
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Unified trade execution error:', error)
|
||||
return { success: false }
|
||||
}
|
||||
}
|
||||
|
||||
private async simulateTrade(params: {
|
||||
symbol: string
|
||||
side: string
|
||||
|
||||
Reference in New Issue
Block a user