even better dash
This commit is contained in:
@ -373,14 +373,17 @@ class CleanTradingDashboard:
|
|||||||
if ws_data_1s is not None and len(ws_data_1s) > 5:
|
if ws_data_1s is not None and len(ws_data_1s) > 5:
|
||||||
fig = make_subplots(
|
fig = make_subplots(
|
||||||
rows=3, cols=1,
|
rows=3, cols=1,
|
||||||
shared_xaxes=True,
|
shared_xaxes=False, # Make 1s chart independent from 1m chart
|
||||||
vertical_spacing=0.05,
|
vertical_spacing=0.08,
|
||||||
subplot_titles=(
|
subplot_titles=(
|
||||||
f'{symbol} - {main_source} ({len(df_main)} bars)',
|
f'{symbol} - {main_source} ({len(df_main)} bars)',
|
||||||
f'1s Mini Chart ({len(ws_data_1s)} bars)',
|
f'1s Mini Chart - Independent Axis ({len(ws_data_1s)} bars)',
|
||||||
'Volume'
|
'Volume'
|
||||||
),
|
),
|
||||||
row_heights=[0.5, 0.25, 0.25]
|
row_heights=[0.5, 0.25, 0.25],
|
||||||
|
specs=[[{"secondary_y": False}],
|
||||||
|
[{"secondary_y": False}],
|
||||||
|
[{"secondary_y": False}]]
|
||||||
)
|
)
|
||||||
has_mini_chart = True
|
has_mini_chart = True
|
||||||
else:
|
else:
|
||||||
@ -448,7 +451,21 @@ class CleanTradingDashboard:
|
|||||||
xaxis_rangeslider_visible=False
|
xaxis_rangeslider_visible=False
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update axes
|
# Update axes with specific configurations for independent charts
|
||||||
|
if has_mini_chart:
|
||||||
|
# Main 1m chart (row 1)
|
||||||
|
fig.update_xaxes(title_text="Time (1m intervals)", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=1, col=1)
|
||||||
|
fig.update_yaxes(title_text="Price (USD)", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=1, col=1)
|
||||||
|
|
||||||
|
# Independent 1s chart (row 2) - can zoom/pan separately
|
||||||
|
fig.update_xaxes(title_text="Time (1s ticks)", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=2, col=1)
|
||||||
|
fig.update_yaxes(title_text="Price (USD)", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=2, col=1)
|
||||||
|
|
||||||
|
# Volume chart (row 3)
|
||||||
|
fig.update_xaxes(title_text="Time", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=3, col=1)
|
||||||
|
fig.update_yaxes(title_text="Volume", showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)', row=3, col=1)
|
||||||
|
else:
|
||||||
|
# Main chart only
|
||||||
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)')
|
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)')
|
||||||
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)')
|
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='rgba(128,128,128,0.2)')
|
||||||
|
|
||||||
@ -675,11 +692,25 @@ class CleanTradingDashboard:
|
|||||||
"""Handle trading decision from orchestrator"""
|
"""Handle trading decision from orchestrator"""
|
||||||
try:
|
try:
|
||||||
# Convert orchestrator decision to dashboard format
|
# Convert orchestrator decision to dashboard format
|
||||||
|
# Handle both TradingDecision objects and dictionary formats
|
||||||
|
if hasattr(decision, 'action'):
|
||||||
|
# This is a TradingDecision object (dataclass)
|
||||||
dashboard_decision = {
|
dashboard_decision = {
|
||||||
'timestamp': datetime.now().strftime('%H:%M:%S'),
|
'timestamp': datetime.now().strftime('%H:%M:%S'),
|
||||||
'action': decision.action if hasattr(decision, 'action') else decision.get('action', 'UNKNOWN'),
|
'action': decision.action,
|
||||||
'confidence': decision.confidence if hasattr(decision, 'confidence') else decision.get('confidence', 0),
|
'confidence': decision.confidence,
|
||||||
'price': decision.price if hasattr(decision, 'price') else decision.get('price', 0),
|
'price': decision.price,
|
||||||
|
'executed': True, # Orchestrator decisions are executed
|
||||||
|
'blocked': False,
|
||||||
|
'manual': False
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# This is a dictionary format
|
||||||
|
dashboard_decision = {
|
||||||
|
'timestamp': datetime.now().strftime('%H:%M:%S'),
|
||||||
|
'action': decision.get('action', 'UNKNOWN'),
|
||||||
|
'confidence': decision.get('confidence', 0),
|
||||||
|
'price': decision.get('price', 0),
|
||||||
'executed': True, # Orchestrator decisions are executed
|
'executed': True, # Orchestrator decisions are executed
|
||||||
'blocked': False,
|
'blocked': False,
|
||||||
'manual': False
|
'manual': False
|
||||||
|
Reference in New Issue
Block a user