Fix presets to match frontend UI exactly
FRONTEND PRESET CORRECTIONS: - Scalp Trading: 5m, 15m, 30m (was 5m, 15m) → 3 timeframes - Day Trading: 1h, 2h (was 1h, 4h) → 2 timeframes - Swing Trading: 4h, 1D (correct) → 2 timeframes UPDATED FILES: - lib/superior-screenshot-service.ts → Correct timeframe definitions - lib/auto-trading-service.ts → TRADING_CONFIGS match frontend - app/api/superior-screenshot/route.js → API presets corrected - Verification and test scripts updated PERFORMANCE ESTIMATES: - Scalp (3 timeframes): ~90s → ~30-40s parallel - Day Trading (2 timeframes): ~60s → ~20-30s parallel - Swing Trading (2 timeframes): ~60s → ~20-30s parallel - Extended (9 timeframes): ~270s → ~70-100s parallel System now matches frontend UI exactly with superior parallel capture!
This commit is contained in:
@@ -17,15 +17,16 @@ export async function POST(request) {
|
|||||||
|
|
||||||
console.log('📋 Superior Config:', config)
|
console.log('📋 Superior Config:', config)
|
||||||
|
|
||||||
// Define trading presets matching the main automation system
|
// Define trading presets matching the frontend UI
|
||||||
const TRADING_PRESETS = {
|
const TRADING_PRESETS = {
|
||||||
'scalp': [
|
'scalp': [
|
||||||
{ name: '5m', tv: '5' },
|
{ name: '5m', tv: '5' },
|
||||||
{ name: '15m', tv: '15' }
|
{ name: '15m', tv: '15' },
|
||||||
|
{ name: '30m', tv: '30' }
|
||||||
],
|
],
|
||||||
'day-trading': [
|
'day-trading': [
|
||||||
{ name: '1h', tv: '60' },
|
{ name: '1h', tv: '60' },
|
||||||
{ name: '4h', tv: '240' }
|
{ name: '2h', tv: '120' }
|
||||||
],
|
],
|
||||||
'swing-trading': [
|
'swing-trading': [
|
||||||
{ name: '4h', tv: '240' },
|
{ name: '4h', tv: '240' },
|
||||||
@@ -38,6 +39,7 @@ export async function POST(request) {
|
|||||||
{ name: '15m', tv: '15' },
|
{ name: '15m', tv: '15' },
|
||||||
{ name: '30m', tv: '30' },
|
{ name: '30m', tv: '30' },
|
||||||
{ name: '1h', tv: '60' },
|
{ name: '1h', tv: '60' },
|
||||||
|
{ name: '2h', tv: '120' },
|
||||||
{ name: '4h', tv: '240' },
|
{ name: '4h', tv: '240' },
|
||||||
{ name: '1D', tv: '1D' }
|
{ name: '1D', tv: '1D' }
|
||||||
]
|
]
|
||||||
@@ -181,10 +183,10 @@ export async function GET() {
|
|||||||
POST: '/api/superior-screenshot - Superior parallel analysis'
|
POST: '/api/superior-screenshot - Superior parallel analysis'
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
'scalp': '2 timeframes (5m, 15m) - Scalping strategy',
|
'scalp': '3 timeframes (5m, 15m, 30m) - Scalping strategy',
|
||||||
'day-trading': '2 timeframes (1h, 4h) - Day trading strategy',
|
'day-trading': '2 timeframes (1h, 2h) - Day trading strategy',
|
||||||
'swing-trading': '2 timeframes (4h, 1D) - Swing trading strategy',
|
'swing-trading': '2 timeframes (4h, 1D) - Swing trading strategy',
|
||||||
'extended': '8 timeframes (1m-1D) - Comprehensive analysis'
|
'extended': '9 timeframes (1m-1D) - Comprehensive analysis'
|
||||||
},
|
},
|
||||||
features: [
|
features: [
|
||||||
'Parallel multi-timeframe capture',
|
'Parallel multi-timeframe capture',
|
||||||
|
|||||||
@@ -88,15 +88,15 @@ export class AutoTradingService {
|
|||||||
let preset: 'scalp' | 'day-trading' | 'swing-trading' | 'custom' = 'custom'
|
let preset: 'scalp' | 'day-trading' | 'swing-trading' | 'custom' = 'custom'
|
||||||
|
|
||||||
// Detect strategy based on timeframe patterns
|
// Detect strategy based on timeframe patterns
|
||||||
if (timeframeSet.has('5') && timeframeSet.has('15') && config.timeframes.length === 2) {
|
if (timeframeSet.has('5') && timeframeSet.has('15') && timeframeSet.has('30') && config.timeframes.length === 3) {
|
||||||
preset = 'scalp'
|
preset = 'scalp'
|
||||||
console.log('🎯 Detected: SCALP trading strategy')
|
console.log('🎯 Detected: SCALP trading strategy (5m, 15m, 30m)')
|
||||||
} else if (timeframeSet.has('60') && timeframeSet.has('240') && config.timeframes.length === 2) {
|
} else if (timeframeSet.has('60') && timeframeSet.has('120') && config.timeframes.length === 2) {
|
||||||
preset = 'day-trading'
|
preset = 'day-trading'
|
||||||
console.log('🎯 Detected: DAY TRADING strategy')
|
console.log('🎯 Detected: DAY TRADING strategy (1h, 2h)')
|
||||||
} else if (timeframeSet.has('240') && timeframeSet.has('1D') && config.timeframes.length === 2) {
|
} else if (timeframeSet.has('240') && timeframeSet.has('1D') && config.timeframes.length === 2) {
|
||||||
preset = 'swing-trading'
|
preset = 'swing-trading'
|
||||||
console.log('🎯 Detected: SWING TRADING strategy')
|
console.log('🎯 Detected: SWING TRADING strategy (4h, 1d)')
|
||||||
} else {
|
} else {
|
||||||
preset = 'custom'
|
preset = 'custom'
|
||||||
console.log('🎯 Using: CUSTOM timeframe configuration')
|
console.log('🎯 Using: CUSTOM timeframe configuration')
|
||||||
@@ -260,7 +260,7 @@ export const TRADING_CONFIGS = {
|
|||||||
// Scalping configuration - frequent analysis of short timeframes
|
// Scalping configuration - frequent analysis of short timeframes
|
||||||
scalping: {
|
scalping: {
|
||||||
symbol: 'SOLUSD',
|
symbol: 'SOLUSD',
|
||||||
timeframes: ['5m', '15m'],
|
timeframes: ['5m', '15m', '30m'], // Updated to match frontend: 5m, 15m, 30m
|
||||||
layouts: ['ai', 'diy'],
|
layouts: ['ai', 'diy'],
|
||||||
intervalMs: 5 * 60 * 1000, // Every 5 minutes
|
intervalMs: 5 * 60 * 1000, // Every 5 minutes
|
||||||
maxCycles: 100 // Limit for testing
|
maxCycles: 100 // Limit for testing
|
||||||
@@ -269,7 +269,7 @@ export const TRADING_CONFIGS = {
|
|||||||
// Day trading configuration - moderate frequency on intraday timeframes
|
// Day trading configuration - moderate frequency on intraday timeframes
|
||||||
dayTrading: {
|
dayTrading: {
|
||||||
symbol: 'SOLUSD',
|
symbol: 'SOLUSD',
|
||||||
timeframes: ['1h', '4h'],
|
timeframes: ['1h', '2h'], // Updated to match frontend: 1h, 2h
|
||||||
layouts: ['ai', 'diy'],
|
layouts: ['ai', 'diy'],
|
||||||
intervalMs: 30 * 60 * 1000, // Every 30 minutes
|
intervalMs: 30 * 60 * 1000, // Every 30 minutes
|
||||||
maxCycles: 50 // Limit for testing
|
maxCycles: 50 // Limit for testing
|
||||||
@@ -278,7 +278,7 @@ export const TRADING_CONFIGS = {
|
|||||||
// Swing trading configuration - less frequent analysis of longer timeframes
|
// Swing trading configuration - less frequent analysis of longer timeframes
|
||||||
swingTrading: {
|
swingTrading: {
|
||||||
symbol: 'SOLUSD',
|
symbol: 'SOLUSD',
|
||||||
timeframes: ['4h', '1d'],
|
timeframes: ['4h', '1d'], // Matches frontend: 4h, 1d
|
||||||
layouts: ['ai', 'diy'],
|
layouts: ['ai', 'diy'],
|
||||||
intervalMs: 2 * 60 * 60 * 1000, // Every 2 hours
|
intervalMs: 2 * 60 * 60 * 1000, // Every 2 hours
|
||||||
maxCycles: 24 // Limit for testing
|
maxCycles: 24 // Limit for testing
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
* Uses the proven scalp preset parallel API technique for maximum efficiency
|
* Uses the proven scalp preset parallel API technique for maximum efficiency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Trading strategy presets matching the main automation system
|
// Trading strategy presets matching the frontend UI
|
||||||
const SCALP_TIMEFRAMES = [
|
const SCALP_TIMEFRAMES = [
|
||||||
{ name: '5m', tv: '5', description: 'Standard scalping' },
|
{ name: '5m', tv: '5', description: 'Standard scalping' },
|
||||||
{ name: '15m', tv: '15', description: 'Swing scalping' }
|
{ name: '15m', tv: '15', description: 'Swing scalping' },
|
||||||
|
{ name: '30m', tv: '30', description: 'Extended scalping' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const DAY_TRADING_TIMEFRAMES = [
|
const DAY_TRADING_TIMEFRAMES = [
|
||||||
{ name: '1h', tv: '60', description: 'Hourly analysis' },
|
{ name: '1h', tv: '60', description: 'Hourly analysis' },
|
||||||
{ name: '4h', tv: '240', description: 'Four-hour trend' }
|
{ name: '2h', tv: '120', description: 'Two-hour trend' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const SWING_TRADING_TIMEFRAMES = [
|
const SWING_TRADING_TIMEFRAMES = [
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ async function testAllPresets() {
|
|||||||
const baseUrl = 'http://localhost:9001'
|
const baseUrl = 'http://localhost:9001'
|
||||||
|
|
||||||
const presets = [
|
const presets = [
|
||||||
{ name: 'Scalp Trading', preset: 'scalp', description: '2 timeframes (5m, 15m)' },
|
{ name: 'Scalp Trading', preset: 'scalp', description: '3 timeframes (5m, 15m, 30m)' },
|
||||||
{ name: 'Day Trading', preset: 'day-trading', description: '2 timeframes (1h, 4h)' },
|
{ name: 'Day Trading', preset: 'day-trading', description: '2 timeframes (1h, 2h)' },
|
||||||
{ name: 'Swing Trading', preset: 'swing-trading', description: '2 timeframes (4h, 1D)' },
|
{ name: 'Swing Trading', preset: 'swing-trading', description: '2 timeframes (4h, 1D)' },
|
||||||
{ name: 'Extended Analysis', preset: 'extended', description: '8+ timeframes (1m-1D)' }
|
{ name: 'Extended Analysis', preset: 'extended', description: '9+ timeframes (1m-1D)' }
|
||||||
]
|
]
|
||||||
|
|
||||||
console.log('\n📋 Testing Strategy:')
|
console.log('\n📋 Testing Strategy:')
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ console.log(' 📁 lib/ai-analysis.ts → Updated for compatibility')
|
|||||||
console.log(' 📁 app/api/enhanced-screenshot/ → Restored with superior backend')
|
console.log(' 📁 app/api/enhanced-screenshot/ → Restored with superior backend')
|
||||||
console.log(' 📁 app/api/superior-screenshot/ → Updated with all presets')
|
console.log(' 📁 app/api/superior-screenshot/ → Updated with all presets')
|
||||||
|
|
||||||
console.log('\n🎯 CURRENT TRADING PRESETS:')
|
console.log('\n🎯 CURRENT TRADING PRESETS (MATCHING FRONTEND UI):')
|
||||||
console.log(' 📊 Scalp Trading: 5m, 15m (2 timeframes) - PARALLEL')
|
console.log(' 📊 Scalp Trading: 5m, 15m, 30m (3 timeframes) - PARALLEL')
|
||||||
console.log(' 📊 Day Trading: 1h, 4h (2 timeframes) - PARALLEL')
|
console.log(' 📊 Day Trading: 1h, 2h (2 timeframes) - PARALLEL')
|
||||||
console.log(' 📊 Swing Trading: 4h, 1D (2 timeframes) - PARALLEL')
|
console.log(' 📊 Swing Trading: 4h, 1D (2 timeframes) - PARALLEL')
|
||||||
console.log(' 📊 Extended: 1m-1D (8 timeframes) - PARALLEL')
|
console.log(' 📊 Extended: 1m-1D (9 timeframes) - PARALLEL')
|
||||||
console.log(' 📊 Custom: Any timeframes - PARALLEL')
|
console.log(' 📊 Custom: Any timeframes - PARALLEL')
|
||||||
|
|
||||||
console.log('\n❌ ELIMINATED ISSUES:')
|
console.log('\n❌ ELIMINATED ISSUES:')
|
||||||
@@ -30,8 +30,9 @@ console.log(' 🚫 No more browser session management complexity')
|
|||||||
|
|
||||||
console.log('\n🚀 PERFORMANCE IMPROVEMENTS:')
|
console.log('\n🚀 PERFORMANCE IMPROVEMENTS:')
|
||||||
console.log(' ⚡ ALL timeframe selections now use parallel capture')
|
console.log(' ⚡ ALL timeframe selections now use parallel capture')
|
||||||
console.log(' ⚡ 2-timeframe strategies: ~60s → ~20-30s')
|
console.log(' ⚡ 3-timeframe scalping: ~90s → ~30-40s')
|
||||||
console.log(' ⚡ 8-timeframe strategies: ~240s → ~60-90s')
|
console.log(' ⚡ 2-timeframe day/swing: ~60s → ~20-30s')
|
||||||
|
console.log(' ⚡ 9-timeframe extended: ~270s → ~70-100s')
|
||||||
console.log(' ⚡ API-managed browser sessions (no cleanup needed)')
|
console.log(' ⚡ API-managed browser sessions (no cleanup needed)')
|
||||||
|
|
||||||
console.log('\n📋 ANSWERS TO YOUR QUESTION:')
|
console.log('\n📋 ANSWERS TO YOUR QUESTION:')
|
||||||
|
|||||||
Reference in New Issue
Block a user