Integrate superior parallel screenshot system into main automation
BREAKING CHANGES: - Replace enhancedScreenshotService with superiorScreenshotService throughout system - Update trading presets to match actual strategy definitions: * Scalp: 5m, 15m (was 7 timeframes) * Day Trading: 1h, 4h (NEW) * Swing Trading: 4h, 1D (NEW) * Extended: All timeframes for comprehensive analysis - Auto-trading service now uses intelligent parallel capture - Enhanced-screenshot API restored with superior backend - AI analysis service updated for compatibility - Superior screenshot API supports all presets PERFORMANCE IMPROVEMENTS: - Parallel capture for ALL timeframes regardless of count - Intelligent preset detection based on timeframe patterns - No more hardcoded 7-timeframe limitation - Backwards compatibility maintained The system now uses the superior parallel approach for ANY timeframe selection, whether it's 2 timeframes (scalp/day/swing) or 8+ timeframes (extended). No more sequential delays - everything is parallel!
This commit is contained in:
@@ -3,26 +3,33 @@
|
||||
* Uses the proven scalp preset parallel API technique for maximum efficiency
|
||||
*/
|
||||
|
||||
// Scalping-focused timeframes (most commonly used)
|
||||
// Trading strategy presets matching the main automation system
|
||||
const SCALP_TIMEFRAMES = [
|
||||
{ name: '1m', tv: '1', description: 'Ultra-short scalping' },
|
||||
{ name: '3m', tv: '3', description: 'Short scalping' },
|
||||
{ name: '5m', tv: '5', description: 'Standard scalping' },
|
||||
{ name: '15m', tv: '15', description: 'Swing scalping' },
|
||||
{ name: '30m', tv: '30', description: 'Longer scalping' },
|
||||
{ name: '1h', tv: '60', description: 'Context timeframe' },
|
||||
{ name: '4h', tv: '240', description: 'Trend context' }
|
||||
{ name: '15m', tv: '15', description: 'Swing scalping' }
|
||||
]
|
||||
|
||||
const DAY_TRADING_TIMEFRAMES = [
|
||||
{ name: '1h', tv: '60', description: 'Hourly analysis' },
|
||||
{ name: '4h', tv: '240', description: 'Four-hour trend' }
|
||||
]
|
||||
|
||||
const SWING_TRADING_TIMEFRAMES = [
|
||||
{ name: '4h', tv: '240', description: 'Four-hour trend' },
|
||||
{ name: '1D', tv: '1D', description: 'Daily analysis' }
|
||||
]
|
||||
|
||||
// Additional timeframes for comprehensive analysis
|
||||
const EXTENDED_TIMEFRAMES = [
|
||||
{ name: '1m', tv: '1', description: 'Ultra-short scalping' },
|
||||
{ name: '3m', tv: '3', description: 'Short scalping' },
|
||||
{ name: '2m', tv: '2', description: 'Very short scalping' },
|
||||
{ name: '10m', tv: '10', description: 'Medium scalping' },
|
||||
{ name: '30m', tv: '30', description: 'Longer scalping' },
|
||||
{ name: '45m', tv: '45', description: 'Extended scalping' },
|
||||
{ name: '2h', tv: '120', description: 'Medium trend' },
|
||||
{ name: '6h', tv: '360', description: 'Long trend' },
|
||||
{ name: '12h', tv: '720', description: 'Daily trend' },
|
||||
{ name: '1D', tv: '1D', description: 'Daily analysis' },
|
||||
{ name: '3D', tv: '3D', description: 'Multi-day trend' },
|
||||
{ name: '1W', tv: '1W', description: 'Weekly analysis' }
|
||||
]
|
||||
@@ -31,7 +38,7 @@ export interface SuperiorScreenshotConfig {
|
||||
symbol: string
|
||||
timeframes?: string[] // If not provided, uses SCALP_TIMEFRAMES
|
||||
layouts?: string[] // Default: ['ai', 'diy']
|
||||
preset?: 'scalp' | 'extended' | 'all' | 'custom'
|
||||
preset?: 'scalp' | 'day-trading' | 'swing-trading' | 'extended' | 'all' | 'custom'
|
||||
analyze?: boolean // Whether to run AI analysis
|
||||
apiUrl?: string // API endpoint (default: http://localhost:9001)
|
||||
}
|
||||
@@ -73,11 +80,17 @@ export class SuperiorScreenshotService {
|
||||
case 'scalp':
|
||||
timeframesToCapture = SCALP_TIMEFRAMES
|
||||
break
|
||||
case 'day-trading':
|
||||
timeframesToCapture = DAY_TRADING_TIMEFRAMES
|
||||
break
|
||||
case 'swing-trading':
|
||||
timeframesToCapture = SWING_TRADING_TIMEFRAMES
|
||||
break
|
||||
case 'extended':
|
||||
timeframesToCapture = [...SCALP_TIMEFRAMES, ...EXTENDED_TIMEFRAMES]
|
||||
timeframesToCapture = [...SCALP_TIMEFRAMES, ...DAY_TRADING_TIMEFRAMES, ...SWING_TRADING_TIMEFRAMES, ...EXTENDED_TIMEFRAMES]
|
||||
break
|
||||
case 'all':
|
||||
timeframesToCapture = [...SCALP_TIMEFRAMES, ...EXTENDED_TIMEFRAMES]
|
||||
timeframesToCapture = [...SCALP_TIMEFRAMES, ...DAY_TRADING_TIMEFRAMES, ...SWING_TRADING_TIMEFRAMES, ...EXTENDED_TIMEFRAMES]
|
||||
break
|
||||
case 'custom':
|
||||
if (config.timeframes) {
|
||||
@@ -214,7 +227,7 @@ export class SuperiorScreenshotService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scalp preset - optimized for scalping strategies
|
||||
* Scalp preset - optimized for scalping strategies (5m, 15m)
|
||||
*/
|
||||
async captureScalpPreset(symbol: string, analyze: boolean = false): Promise<ScreenshotResult[]> {
|
||||
return this.captureParallel({
|
||||
@@ -225,6 +238,30 @@ export class SuperiorScreenshotService {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Day trading preset - moderate timeframes (1h, 4h)
|
||||
*/
|
||||
async captureDayTradingPreset(symbol: string, analyze: boolean = false): Promise<ScreenshotResult[]> {
|
||||
return this.captureParallel({
|
||||
symbol,
|
||||
preset: 'day-trading',
|
||||
layouts: ['ai', 'diy'],
|
||||
analyze
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Swing trading preset - longer timeframes (4h, 1D)
|
||||
*/
|
||||
async captureSwingTradingPreset(symbol: string, analyze: boolean = false): Promise<ScreenshotResult[]> {
|
||||
return this.captureParallel({
|
||||
symbol,
|
||||
preset: 'swing-trading',
|
||||
layouts: ['ai', 'diy'],
|
||||
analyze
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Extended preset - comprehensive timeframe analysis
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user