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:
mindesbunister
2025-07-22 16:05:29 +02:00
parent fb194f1b12
commit 4f553dcfb6
34 changed files with 7133 additions and 2221 deletions

View File

@@ -1,56 +1,29 @@
// Analysis completion flag manager
// This ensures cleanup only happens after the entire analysis cycle is complete
class AnalysisCompletionFlag {
private static instance: AnalysisCompletionFlag
private isAnalysisComplete = false
private currentSessionId: string | null = null
private constructor() {}
static getInstance(): AnalysisCompletionFlag {
if (!AnalysisCompletionFlag.instance) {
AnalysisCompletionFlag.instance = new AnalysisCompletionFlag()
// Analysis completion flag utility
export const analysisCompletionFlag = {
isComplete: false,
currentSession: null as string | null,
setComplete: (value: boolean) => {
analysisCompletionFlag.isComplete = value
},
getComplete: () => analysisCompletionFlag.isComplete,
startAnalysisCycle: (sessionId: string) => {
analysisCompletionFlag.currentSession = sessionId
analysisCompletionFlag.isComplete = false
},
endAnalysisCycle: () => {
analysisCompletionFlag.isComplete = true
analysisCompletionFlag.currentSession = null
},
markAnalysisComplete: (sessionId: string) => {
if (analysisCompletionFlag.currentSession === sessionId) {
analysisCompletionFlag.isComplete = true
}
return AnalysisCompletionFlag.instance
}
// Called at the start of each analysis cycle
startAnalysisCycle(sessionId: string) {
console.log(`🚀 Starting analysis cycle: ${sessionId}`)
this.isAnalysisComplete = false
this.currentSessionId = sessionId
}
// Called at the end of each analysis cycle
markAnalysisComplete(sessionId: string) {
if (sessionId === this.currentSessionId) {
console.log(`✅ Analysis cycle complete: ${sessionId}`)
this.isAnalysisComplete = true
} else {
console.log(`⚠️ Session ID mismatch: expected ${this.currentSessionId}, got ${sessionId}`)
}
}
// Check if analysis is complete and cleanup can proceed
canCleanup(): boolean {
return this.isAnalysisComplete
}
// Get current session info
getCurrentSession(): { sessionId: string | null; isComplete: boolean } {
return {
sessionId: this.currentSessionId,
isComplete: this.isAnalysisComplete
}
}
// Reset flag (for manual cleanup or new cycles)
reset() {
console.log(`🔄 Resetting analysis completion flag`)
this.isAnalysisComplete = false
this.currentSessionId = null
}
}
export const analysisCompletionFlag = AnalysisCompletionFlag.getInstance()
export default analysisCompletionFlag