This commit is contained in:
Dobromir Popov
2025-11-22 15:25:57 +02:00
parent bccac9614d
commit 2f28fcc89a
7 changed files with 174 additions and 35 deletions

View File

@@ -626,8 +626,7 @@ class AnnotationDashboard:
if not self.orchestrator:
logger.info("Initializing TradingOrchestrator...")
self.orchestrator = TradingOrchestrator(
data_provider=self.data_provider,
config=self.config
data_provider=self.data_provider
)
self.training_adapter.orchestrator = self.orchestrator
logger.info("TradingOrchestrator initialized")
@@ -1709,6 +1708,9 @@ class AnnotationDashboard:
# CRITICAL: Get current symbol to filter annotations
current_symbol = data.get('symbol', 'ETH/USDT')
# Get primary timeframe for display (optional)
timeframe = data.get('timeframe', '1m')
# If no specific annotations provided, use all for current symbol
if not annotation_ids:
annotations = self.annotation_manager.get_annotations(symbol=current_symbol)
@@ -1737,12 +1739,14 @@ class AnnotationDashboard:
}
})
logger.info(f"Starting REAL training with {len(test_cases)} test cases for model {model_name}")
logger.info(f"Starting REAL training with {len(test_cases)} test cases ({len(annotation_ids)} annotations) for model {model_name} on {timeframe}")
# Start REAL training (NO SIMULATION!)
training_id = self.training_adapter.start_training(
model_name=model_name,
test_cases=test_cases
test_cases=test_cases,
annotation_count=len(annotation_ids),
timeframe=timeframe
)
return jsonify({

View File

@@ -10,6 +10,7 @@
/* Chart Panel */
.chart-panel {
height: calc(100vh - 150px);
transition: all 0.3s ease;
}
.chart-panel .card-body {
@@ -17,6 +18,29 @@
overflow: hidden;
}
/* Maximized Chart View */
.chart-maximized {
width: 100% !important;
max-width: 100% !important;
flex: 0 0 100% !important;
transition: all 0.3s ease;
}
.chart-panel-maximized {
height: calc(100vh - 80px) !important;
position: fixed;
top: 60px;
left: 0;
right: 0;
z-index: 1040;
margin: 0 !important;
border-radius: 0 !important;
}
.chart-panel-maximized .card-body {
height: calc(100% - 60px);
}
#chart-container {
height: 100%;
overflow-y: auto;
@@ -236,11 +260,32 @@
padding: 1rem;
}
/* Maximized View - Larger Charts */
.chart-panel-maximized .chart-plot {
height: 400px;
}
@media (min-width: 1400px) {
.chart-panel-maximized .chart-plot {
height: 450px;
}
}
@media (min-width: 1920px) {
.chart-panel-maximized .chart-plot {
height: 500px;
}
}
/* Responsive Adjustments */
@media (max-width: 1200px) {
.chart-plot {
height: 250px;
}
.chart-panel-maximized .chart-plot {
height: 350px;
}
}
@media (max-width: 768px) {

View File

@@ -101,6 +101,23 @@
if (typeof checkActiveTraining === 'function') {
checkActiveTraining();
}
// Keyboard shortcuts for chart maximization
document.addEventListener('keydown', function(e) {
// ESC key to exit maximized mode
if (e.key === 'Escape') {
const chartArea = document.querySelector('.chart-maximized');
if (chartArea) {
document.getElementById('maximize-btn').click();
}
}
// F key to toggle maximize (when not typing in input)
if (e.key === 'f' && !e.ctrlKey && !e.metaKey &&
!['INPUT', 'TEXTAREA', 'SELECT'].includes(document.activeElement.tagName)) {
document.getElementById('maximize-btn').click();
}
});
// Setup keyboard shortcuts
setupKeyboardShortcuts();

View File

@@ -14,6 +14,9 @@
<button type="button" class="btn btn-outline-light" id="reset-zoom-btn" title="Reset Zoom">
<i class="fas fa-expand"></i>
</button>
<button type="button" class="btn btn-outline-light" id="maximize-btn" title="Maximize Chart Area">
<i class="fas fa-arrows-alt"></i>
</button>
<button type="button" class="btn btn-outline-light" id="fullscreen-btn" title="Fullscreen">
<i class="fas fa-expand-arrows-alt"></i>
</button>
@@ -110,6 +113,41 @@
}
});
document.getElementById('maximize-btn').addEventListener('click', function () {
const mainRow = document.querySelector('.row.mt-3');
const leftSidebar = mainRow.querySelector('.col-md-2:first-child');
const chartArea = mainRow.querySelector('.col-md-8');
const rightSidebar = mainRow.querySelector('.col-md-2:last-child');
const chartPanel = document.querySelector('.chart-panel');
const maximizeIcon = this.querySelector('i');
// Toggle maximize state
if (chartArea.classList.contains('chart-maximized')) {
// Restore normal view
leftSidebar.style.display = '';
rightSidebar.style.display = '';
chartArea.classList.remove('chart-maximized');
chartPanel.classList.remove('chart-panel-maximized');
maximizeIcon.className = 'fas fa-arrows-alt';
this.title = 'Maximize Chart Area';
} else {
// Maximize chart area
leftSidebar.style.display = 'none';
rightSidebar.style.display = 'none';
chartArea.classList.add('chart-maximized');
chartPanel.classList.add('chart-panel-maximized');
maximizeIcon.className = 'fas fa-compress-arrows-alt';
this.title = 'Restore Normal View';
}
// Update chart layouts after transition
setTimeout(() => {
if (window.appState && window.appState.chartManager) {
window.appState.chartManager.updateChartLayout();
}
}, 350);
});
document.getElementById('fullscreen-btn').addEventListener('click', function () {
const chartContainer = document.getElementById('chart-container');
if (chartContainer.requestFullscreen) {

View File

@@ -40,9 +40,13 @@
role="progressbar" style="width: 0%"></div>
</div>
<div class="small">
<div>Epoch: <span id="training-epoch">0</span>/<span id="training-total-epochs">0</span></div>
<div>Loss: <span id="training-loss">--</span></div>
<div>GPU: <span id="training-gpu-util">--</span>% | CPU: <span id="training-cpu-util">--</span>%</div>
<div>Annotations: <span id="training-annotation-count" class="fw-bold text-primary">--</span></div>
<div>Timeframe: <span id="training-timeframe" class="fw-bold text-info">--</span></div>
<div class="mt-1 pt-1 border-top">
<div>Epoch: <span id="training-epoch">0</span>/<span id="training-total-epochs">0</span></div>
<div>Loss: <span id="training-loss">--</span></div>
<div>GPU: <span id="training-gpu-util">--</span>% | CPU: <span id="training-cpu-util">--</span>%</div>
</div>
</div>
</div>
</div>
@@ -193,6 +197,15 @@
// Resume tracking
activeTrainingId = data.session.training_id;
showTrainingStatus();
// Populate annotation count and timeframe if available
if (data.session.annotation_count) {
document.getElementById('training-annotation-count').textContent = data.session.annotation_count;
}
if (data.session.timeframe) {
document.getElementById('training-timeframe').textContent = data.session.timeframe.toUpperCase();
}
pollTrainingProgress(activeTrainingId);
} else {
console.log('No active training session');
@@ -408,10 +421,17 @@
// Show training status
showTrainingStatus();
// Get primary timeframe for training
const primaryTimeframe = document.getElementById('primary-timeframe-select').value;
// Reset progress
document.getElementById('training-progress-bar').style.width = '0%';
document.getElementById('training-epoch').textContent = '0';
document.getElementById('training-loss').textContent = '--';
// Set annotation count and timeframe
document.getElementById('training-annotation-count').textContent = annotationIds.length;
document.getElementById('training-timeframe').textContent = primaryTimeframe.toUpperCase();
// Start training request
fetch('/api/train-model', {
@@ -420,7 +440,8 @@
body: JSON.stringify({
model_name: modelName,
annotation_ids: annotationIds,
symbol: appState.currentSymbol // CRITICAL: Filter by current symbol
symbol: appState.currentSymbol, // CRITICAL: Filter by current symbol
timeframe: primaryTimeframe // Primary timeframe for display
})
})
.then(response => response.json())