From 967e56c64c1d3e4dcc1ef619f6776d35582cd60b Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Mon, 20 Apr 2026 22:54:26 +0200 Subject: [PATCH] =?UTF-8?q?cleanup(dead):=20remove=20dead=20opportunity=5F?= =?UTF-8?q?scores=20API=20=E2=80=94=20[DEAD-002]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MultiAssetPortfolioTracker.opportunity_scores field and its two public methods (set_opportunity_scores, select_active_symbol) had zero callers workspace-wide per rg. Also eliminates the FALLBACK-001 symbols[0] default — that else branch was inside the now-removed dead method. Deleted: field + 2 init sites + 2 pub methods + architecture doc line. Per user directive "no deferred tasks, solve properly" — was previously marked as DEFERRED (FALLBACK-001 false-positive flagging dead code). --- crates/ml-dqn/src/multi_asset.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/crates/ml-dqn/src/multi_asset.rs b/crates/ml-dqn/src/multi_asset.rs index 794abfb8d..33338e412 100644 --- a/crates/ml-dqn/src/multi_asset.rs +++ b/crates/ml-dqn/src/multi_asset.rs @@ -12,7 +12,6 @@ //! MultiAssetPortfolioTracker //! ├── positions: HashMap //! ├── correlation_matrix: Array2 -//! ├── opportunity_scores: HashMap //! └── portfolio_history: Vec //! ``` //! @@ -67,8 +66,6 @@ pub struct MultiAssetPortfolioTracker { correlation_matrix: Array2, /// List of all symbols in order (for indexing into correlation matrix) symbols: Vec, - /// Opportunity scores for symbol selection (e.g., volatility, momentum) - opportunity_scores: HashMap, /// Portfolio value history for analytics portfolio_history: Vec, /// Trade P&L history for win rate calculation @@ -117,14 +114,10 @@ impl MultiAssetPortfolioTracker { // Initialize correlation matrix as identity (uncorrelated) let correlation_matrix = Array2::eye(num_symbols); - // Initialize opportunity scores to zero - let opportunity_scores = symbols.iter().map(|sym| (sym.clone(), 0.0)).collect(); - Self { positions, correlation_matrix, symbols, - opportunity_scores, portfolio_history: Vec::new(), trade_pnls: Vec::new(), max_positions: HashMap::new(), @@ -156,13 +149,11 @@ impl MultiAssetPortfolioTracker { .collect(); let correlation_matrix = Array2::eye(num_symbols); - let opportunity_scores = symbols.iter().map(|sym| (sym.clone(), 0.0)).collect(); Self { positions, correlation_matrix, symbols, - opportunity_scores, portfolio_history: Vec::new(), trade_pnls: Vec::new(), max_positions: HashMap::new(), @@ -300,28 +291,6 @@ impl MultiAssetPortfolioTracker { variance.abs().sqrt() } - /// Set opportunity scores for symbol selection - /// - /// # Arguments - /// - /// * `scores` - Opportunity scores per symbol (higher = more attractive) - pub fn set_opportunity_scores(&mut self, scores: HashMap) { - self.opportunity_scores = scores; - } - - /// Select active symbol based on opportunity scores - /// - /// # Returns - /// - /// Symbol with highest opportunity score - pub fn select_active_symbol(&self) -> Symbol { - self.opportunity_scores - .iter() - .max_by(|(_, a), (_, b)| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal)) - .map(|(sym, _)| sym.clone()) - .unwrap_or_else(|| self.symbols[0].clone()) - } - /// Build state vector for DQN input /// /// # Format