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:
@@ -364,7 +364,7 @@ export default function AutomationPageV2() {
|
||||
<div className="p-2 bg-gray-800/30 rounded-lg mb-3">
|
||||
<div className="text-xs text-gray-400">
|
||||
Selected: <span className="text-cyan-400">
|
||||
{config.selectedTimeframes.map(tf => timeframes.find(t => t.value === tf)?.label).filter(Boolean).join(', ')}
|
||||
{(status.selectedTimeframes || [status.timeframe]).map(tf => timeframes.find(t => t.value === tf)?.label || tf).filter(Boolean).join(', ')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 mt-1">
|
||||
@@ -499,7 +499,7 @@ export default function AutomationPageV2() {
|
||||
<div className="flex justify-between">
|
||||
<span className="text-gray-300">Timeframes:</span>
|
||||
<span className="text-cyan-400 font-semibold text-xs">
|
||||
{config.selectedTimeframes.map(tf => timeframes.find(t => t.value === tf)?.label).filter(Boolean).join(', ')}
|
||||
{(status.selectedTimeframes || [status.timeframe]).map(tf => timeframes.find(t => t.value === tf)?.label || tf).filter(Boolean).join(', ')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user