COB fixes
This commit is contained in:
@ -1427,7 +1427,7 @@ class CleanTradingDashboard:
|
||||
try:
|
||||
times, prices, matrix = [], [], []
|
||||
if hasattr(self.data_provider, 'get_cob_heatmap_matrix'):
|
||||
times, prices, matrix = 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'
|
||||
)
|
||||
if not times or not prices or not matrix:
|
||||
@ -1448,6 +1448,31 @@ class CleanTradingDashboard:
|
||||
zmin=0.0,
|
||||
zmax=1.0
|
||||
))
|
||||
# Overlay price line projected onto y-axis buckets
|
||||
try:
|
||||
bucket_size = abs(prices[1] - prices[0]) if len(prices) > 1 else 1.0
|
||||
price_line = mids if 'mids' in locals() and mids else []
|
||||
if price_line:
|
||||
# Map mid prices to bucket index positions
|
||||
y_vals = []
|
||||
y_labels = [float(p) for p in prices]
|
||||
for m in price_line:
|
||||
if m and bucket_size > 0:
|
||||
# find nearest bucket
|
||||
idx = int(round((m - y_labels[0]) / bucket_size))
|
||||
idx = max(0, min(len(y_labels) - 1, idx))
|
||||
y_vals.append(y_labels[idx])
|
||||
else:
|
||||
y_vals.append(None)
|
||||
fig.add_trace(go.Scatter(
|
||||
x=[t.strftime('%H:%M:%S') for t in times],
|
||||
y=[f"{yv:.2f}" if yv is not None else None for yv in y_vals],
|
||||
mode='lines',
|
||||
line=dict(color='white', width=1.5),
|
||||
name='Mid Price'
|
||||
))
|
||||
except Exception as _line_ex:
|
||||
logger.debug(f"Price line overlay skipped: {_line_ex}")
|
||||
fig.update_layout(
|
||||
title="ETH COB Heatmap (liquidity, per-bucket normalized)",
|
||||
xaxis_title="Time",
|
||||
@ -1475,16 +1500,16 @@ class CleanTradingDashboard:
|
||||
"""Update training metrics using new clean panel implementation"""
|
||||
logger.info(f"update_training_metrics callback triggered with slow_intervals={slow_intervals}, fast_intervals={fast_intervals}, n_clicks={n_clicks}")
|
||||
try:
|
||||
# Import the new panel implementation
|
||||
# Import compact training panel
|
||||
from web.models_training_panel import ModelsTrainingPanel
|
||||
|
||||
# Create panel instance with orchestrator
|
||||
panel = ModelsTrainingPanel(orchestrator=self.orchestrator)
|
||||
|
||||
# Generate the panel content
|
||||
panel_content = panel.create_panel()
|
||||
# Render the panel
|
||||
panel_content = panel.render()
|
||||
|
||||
logger.info("Successfully created new training metrics panel")
|
||||
logger.info("Successfully created training metrics panel")
|
||||
return panel_content
|
||||
|
||||
except PreventUpdate:
|
||||
|
Reference in New Issue
Block a user