fix: correct timeframe display in Bot Status for scalping strategies

- Add selectedTimeframes to automation status API response to show actual running timeframes
- Update Bot Status UI to display selectedTimeframes from API instead of local config state
- Fix issue where Bot Status showed '1h' instead of scalping timeframes '5m, 15m, 30m'
- Ensure selectedTimeframes are properly stored in database settings and retrieved in status
- Bot Status now correctly reflects the actual running automation configuration

UI Changes:
- Bot Status timeframes now shows: '5m, 15m, 30m' for scalping instead of '1h'
- Analysis Timer correctly shows 2-minute intervals for scalping strategies
- Status display is now synchronized with actual automation configuration

Backend Changes:
- Store selectedTimeframes in automation session settings
- Include selectedTimeframes in getStatus() API response
- Enhanced interval detection to support settings-based timeframes
This commit is contained in:
mindesbunister
2025-07-24 14:55:34 +02:00
parent 451a8248d8
commit e1d8c0c65a
2 changed files with 6 additions and 4 deletions

View File

@@ -103,6 +103,7 @@ export class AutomationService {
maxLeverage: config.maxLeverage,
// stopLossPercent and takeProfitPercent removed - AI calculates these automatically
maxDailyTrades: config.maxDailyTrades,
selectedTimeframes: config.selectedTimeframes,
riskPercentage: config.riskPercentage
},
startBalance: config.tradingAmount,
@@ -169,8 +170,8 @@ export class AutomationService {
private getIntervalFromTimeframe(timeframe: string): number {
// Check if this is a scalping strategy (multiple short timeframes)
if (this.config?.selectedTimeframes) {
const timeframes = this.config.selectedTimeframes
if (this.config?.selectedTimeframes || this.config?.settings?.selectedTimeframes) {
const timeframes = this.config.selectedTimeframes || this.config.settings?.selectedTimeframes
const isScalping = timeframes.includes('5') || timeframes.includes('3') || (timeframes.length > 1 && timeframes.every(tf => ['1', '3', '5', '15', '30'].includes(tf)))
if (isScalping) {
console.log('🎯 Scalping strategy detected - using frequent analysis (2-3 minutes)')
@@ -1366,6 +1367,7 @@ ${validResults.map(r => `• ${r.timeframe}: ${r.analysis?.recommendation} (${r.
mode: session.mode as 'SIMULATION' | 'LIVE',
symbol: session.symbol,
timeframe: session.timeframe,
selectedTimeframes: session.settings?.selectedTimeframes,
totalTrades: session.totalTrades,
successfulTrades: session.successfulTrades,
winRate: session.winRate,