COB info restored, better COB heatmap, restore kill processes

This commit is contained in:
Dobromir Popov
2025-08-09 00:58:36 +03:00
parent 71ba37ccc2
commit 87193f3d6f
6 changed files with 152 additions and 89 deletions

View File

@ -1370,6 +1370,7 @@ class CleanTradingDashboard:
eth_rate = _calc_update_rate('ETH/USDT')
btc_rate = _calc_update_rate('BTC/USDT')
# Unified COB timeseries source: provider's 1s aggregation
eth_agg_1s = self.data_provider.get_cob_1s_aggregated('ETH/USDT') if hasattr(self.data_provider, 'get_cob_1s_aggregated') else []
btc_agg_1s = self.data_provider.get_cob_1s_aggregated('BTC/USDT') if hasattr(self.data_provider, 'get_cob_1s_aggregated') else []
eth_recent = _recent_ticks('ETH/USDT')
@ -1425,11 +1426,10 @@ class CleanTradingDashboard:
def update_cob_heatmap_eth(n):
"""Render ETH COB 1s heatmap (±10 buckets, last 5 minutes)."""
try:
# Unified heatmap source from provider
times, prices, matrix = [], [], []
if hasattr(self.data_provider, 'get_cob_heatmap_matrix'):
times, prices, matrix, mids = self.data_provider.get_cob_heatmap_matrix(
'ETH/USDT', seconds=300, bucket_radius=10, metric='liquidity'
)
times, prices, matrix, mids = self.data_provider.get_cob_heatmap_matrix('ETH/USDT', seconds=300, bucket_radius=10, metric='liquidity')
if not times or not prices or not matrix:
fig = go.Figure()
fig.add_annotation(text="No COB heatmap data", xref="paper", yref="paper", x=0.5, y=0.5, showarrow=False)
@ -1493,11 +1493,10 @@ class CleanTradingDashboard:
)
def update_cob_heatmap_btc(n):
try:
# Unified heatmap source from provider
times, prices, matrix = [], [], []
if hasattr(self.data_provider, 'get_cob_heatmap_matrix'):
times, prices, matrix, mids = self.data_provider.get_cob_heatmap_matrix(
'BTC/USDT', seconds=300, bucket_radius=10, metric='liquidity'
)
times, prices, matrix, mids = self.data_provider.get_cob_heatmap_matrix('BTC/USDT', seconds=300, bucket_radius=10, metric='liquidity')
if not times or not prices or not matrix:
fig = go.Figure()
fig.add_annotation(text="No COB heatmap data", xref="paper", yref="paper", x=0.5, y=0.5, showarrow=False)
@ -1570,8 +1569,13 @@ class CleanTradingDashboard:
# Create panel instance with orchestrator
panel = ModelsTrainingPanel(orchestrator=self.orchestrator)
# Render the panel
panel_content = panel.render()
# Prefer create_panel if available; fallback to render
if hasattr(panel, 'create_panel'):
panel_content = panel.create_panel()
elif hasattr(panel, 'render'):
panel_content = panel.render()
else:
panel_content = html.Div([html.Div("Training panel not available", className="text-muted small")])
logger.info("Successfully created training metrics panel")
return panel_content