dynamic profitabiliy reward
This commit is contained in:
@ -496,6 +496,7 @@ class CleanTradingDashboard:
|
||||
Output('current-position', 'children'),
|
||||
Output('trade-count', 'children'),
|
||||
Output('portfolio-value', 'children'),
|
||||
Output('profitability-multiplier', 'children'),
|
||||
Output('mexc-status', 'children')],
|
||||
[Input('interval-component', 'n_intervals')]
|
||||
)
|
||||
@ -600,6 +601,20 @@ class CleanTradingDashboard:
|
||||
portfolio_value = current_balance + total_session_pnl # Live balance + unrealized P&L
|
||||
portfolio_str = f"${portfolio_value:.2f}"
|
||||
|
||||
# Profitability multiplier - get from trading executor
|
||||
profitability_multiplier = 0.0
|
||||
success_rate = 0.0
|
||||
if self.trading_executor and hasattr(self.trading_executor, 'get_profitability_reward_multiplier'):
|
||||
profitability_multiplier = self.trading_executor.get_profitability_reward_multiplier()
|
||||
if hasattr(self.trading_executor, '_calculate_recent_success_rate'):
|
||||
success_rate = self.trading_executor._calculate_recent_success_rate()
|
||||
|
||||
# Format profitability multiplier display
|
||||
if profitability_multiplier > 0:
|
||||
multiplier_str = f"+{profitability_multiplier:.1f}x ({success_rate:.0%})"
|
||||
else:
|
||||
multiplier_str = f"0.0x ({success_rate:.0%})" if success_rate > 0 else "0.0x"
|
||||
|
||||
# MEXC status - enhanced with sync status
|
||||
mexc_status = "SIM"
|
||||
if self.trading_executor:
|
||||
@ -607,11 +622,11 @@ class CleanTradingDashboard:
|
||||
if hasattr(self.trading_executor, 'simulation_mode') and not self.trading_executor.simulation_mode:
|
||||
mexc_status = "LIVE+SYNC" # Indicate live trading with position sync
|
||||
|
||||
return price_str, session_pnl_str, position_str, trade_str, portfolio_str, mexc_status
|
||||
return price_str, session_pnl_str, position_str, trade_str, portfolio_str, multiplier_str, mexc_status
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error updating metrics: {e}")
|
||||
return "Error", "$0.00", "Error", "0", "$100.00", "ERROR"
|
||||
return "Error", "$0.00", "Error", "0", "$100.00", "0.0x", "ERROR"
|
||||
|
||||
@self.app.callback(
|
||||
Output('recent-decisions', 'children'),
|
||||
|
Reference in New Issue
Block a user