UI and stability

This commit is contained in:
Dobromir Popov
2025-07-28 14:05:37 +03:00
parent 25b2d3840a
commit 44821b2a89
7 changed files with 934 additions and 135 deletions

View File

@ -10,9 +10,10 @@ from datetime import datetime
class DashboardLayoutManager:
"""Manages dashboard layout and structure"""
def __init__(self, starting_balance: float = 100.0, trading_executor=None):
def __init__(self, starting_balance: float = 100.0, trading_executor=None, dashboard=None):
self.starting_balance = starting_balance
self.trading_executor = trading_executor
self.dashboard = dashboard
def create_main_layout(self):
"""Create the main dashboard layout"""
@ -153,6 +154,48 @@ class DashboardLayoutManager:
"Session Controls"
], className="card-title mb-2"),
# Trading Agent Mode Toggle
html.Div([
html.Label([
html.I(className="fas fa-robot me-1"),
"Trading Agent: ",
html.Span(
id="trading-mode-display",
children="LIVE" if getattr(self.dashboard, 'trading_mode_live', False) else "SIM",
className="fw-bold text-danger" if getattr(self.dashboard, 'trading_mode_live', False) else "fw-bold text-warning"
)
], className="form-label small mb-1"),
dcc.Checklist(
id='trading-mode-switch',
options=[{'label': '', 'value': 'live'}],
value=['live'] if getattr(self.dashboard, 'trading_mode_live', False) else [],
className="form-check-input"
),
html.Small("SIM = Simulation Mode, LIVE = Real Trading", className="text-muted d-block")
], className="mb-2"),
# Cold Start Training Toggle
html.Div([
html.Label([
html.I(className="fas fa-fire me-1"),
"Cold Start Training: ",
html.Span(
id="cold-start-display",
children="ON" if getattr(self.dashboard, 'cold_start_enabled', True) else "OFF",
className="fw-bold text-success" if getattr(self.dashboard, 'cold_start_enabled', True) else "fw-bold text-secondary"
)
], className="form-label small mb-1"),
dcc.Checklist(
id='cold-start-switch',
options=[{'label': '', 'value': 'enabled'}],
value=['enabled'] if getattr(self.dashboard, 'cold_start_enabled', True) else [],
className="form-check-input"
),
html.Small("Excessive training during cold start", className="text-muted d-block")
], className="mb-2"),
html.Hr(className="my-2"),
# Leverage Control
html.Div([
html.Label([