fixed cob
This commit is contained in:
@ -514,8 +514,11 @@ class CleanTradingDashboard:
|
||||
eth_imbalance_stats = self._calculate_cumulative_imbalance('ETH/USDT')
|
||||
btc_imbalance_stats = self._calculate_cumulative_imbalance('BTC/USDT')
|
||||
|
||||
eth_components = self.component_manager.format_cob_data(eth_snapshot, 'ETH/USDT', eth_imbalance_stats)
|
||||
btc_components = self.component_manager.format_cob_data(btc_snapshot, 'BTC/USDT', btc_imbalance_stats)
|
||||
# Determine COB data source mode
|
||||
cob_mode = self._get_cob_mode()
|
||||
|
||||
eth_components = self.component_manager.format_cob_data(eth_snapshot, 'ETH/USDT', eth_imbalance_stats, cob_mode)
|
||||
btc_components = self.component_manager.format_cob_data(btc_snapshot, 'BTC/USDT', btc_imbalance_stats, cob_mode)
|
||||
|
||||
return eth_components, btc_components
|
||||
|
||||
@ -580,6 +583,34 @@ class CleanTradingDashboard:
|
||||
return f"x{leverage_value}"
|
||||
return "x50"
|
||||
|
||||
# Entry Aggressiveness slider callback
|
||||
@self.app.callback(
|
||||
Output('entry-agg-display', 'children'),
|
||||
[Input('entry-aggressiveness-slider', 'value')]
|
||||
)
|
||||
def update_entry_aggressiveness_display(agg_value):
|
||||
"""Update entry aggressiveness display and orchestrator setting"""
|
||||
if agg_value is not None:
|
||||
# Update orchestrator's entry aggressiveness
|
||||
if self.orchestrator:
|
||||
self.orchestrator.entry_aggressiveness = agg_value
|
||||
return f"{agg_value:.1f}"
|
||||
return "0.5"
|
||||
|
||||
# Exit Aggressiveness slider callback
|
||||
@self.app.callback(
|
||||
Output('exit-agg-display', 'children'),
|
||||
[Input('exit-aggressiveness-slider', 'value')]
|
||||
)
|
||||
def update_exit_aggressiveness_display(agg_value):
|
||||
"""Update exit aggressiveness display and orchestrator setting"""
|
||||
if agg_value is not None:
|
||||
# Update orchestrator's exit aggressiveness
|
||||
if self.orchestrator:
|
||||
self.orchestrator.exit_aggressiveness = agg_value
|
||||
return f"{agg_value:.1f}"
|
||||
return "0.5"
|
||||
|
||||
# Clear session button
|
||||
@self.app.callback(
|
||||
Output('clear-session-btn', 'children'),
|
||||
@ -1953,6 +1984,27 @@ class CleanTradingDashboard:
|
||||
except Exception as e:
|
||||
logger.warning(f"Error getting COB snapshot for {symbol}: {e}")
|
||||
return None
|
||||
|
||||
def _get_cob_mode(self) -> str:
|
||||
"""Get current COB data collection mode"""
|
||||
try:
|
||||
# Check if orchestrator COB integration is working
|
||||
if hasattr(self.orchestrator, 'cob_integration') and self.orchestrator.cob_integration:
|
||||
# Try to get a snapshot from orchestrator
|
||||
snapshot = self.orchestrator.cob_integration.get_cob_snapshot('ETH/USDT')
|
||||
if snapshot and hasattr(snapshot, 'consolidated_bids') and snapshot.consolidated_bids:
|
||||
return "WS" # WebSocket/Advanced mode
|
||||
|
||||
# Check if fallback data is available
|
||||
if hasattr(self, 'latest_cob_data') and 'ETH/USDT' in self.latest_cob_data:
|
||||
if self.latest_cob_data['ETH/USDT']:
|
||||
return "REST" # REST API fallback mode
|
||||
|
||||
return "None" # No data available
|
||||
|
||||
except Exception as e:
|
||||
logger.debug(f"Error determining COB mode: {e}")
|
||||
return "Error"
|
||||
|
||||
def _get_enhanced_training_stats(self) -> Dict[str, Any]:
|
||||
"""Get enhanced training statistics from the training system and orchestrator"""
|
||||
|
Reference in New Issue
Block a user