cleanup(dead): remove dead opportunity_scores API — [DEAD-002]

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).
This commit is contained in:
jgrusewski
2026-04-20 22:54:26 +02:00
parent e8eee1ed87
commit 967e56c64c

View File

@@ -12,7 +12,6 @@
//! MultiAssetPortfolioTracker
//! ├── positions: HashMap<Symbol, PortfolioTracker>
//! ├── correlation_matrix: Array2<f64>
//! ├── opportunity_scores: HashMap<Symbol, f64>
//! └── portfolio_history: Vec<PortfolioSnapshot>
//! ```
//!
@@ -67,8 +66,6 @@ pub struct MultiAssetPortfolioTracker {
correlation_matrix: Array2<f64>,
/// List of all symbols in order (for indexing into correlation matrix)
symbols: Vec<Symbol>,
/// Opportunity scores for symbol selection (e.g., volatility, momentum)
opportunity_scores: HashMap<Symbol, f64>,
/// Portfolio value history for analytics
portfolio_history: Vec<PortfolioSnapshot>,
/// 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<Symbol, f64>) {
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