Merge branch 'fix/remove-dead-code'
This commit is contained in:
@@ -135,8 +135,6 @@ pub struct BacktestEngine {
|
||||
config: BacktestConfig,
|
||||
/// Market data replay engine
|
||||
market_replay: Arc<MarketReplay>,
|
||||
/// Strategy being tested
|
||||
strategy: Option<Box<dyn Strategy>>,
|
||||
/// Strategy tester
|
||||
strategy_tester: Option<StrategyTester>,
|
||||
/// Performance metrics calculator
|
||||
@@ -188,8 +186,6 @@ impl Default for BacktestState {
|
||||
pub struct PerformanceMonitor {
|
||||
/// Memory usage tracking
|
||||
memory_usage: Arc<std::sync::atomic::AtomicUsize>,
|
||||
/// CPU usage tracking
|
||||
cpu_usage: Arc<std::sync::atomic::AtomicU64>,
|
||||
/// Event processing rate
|
||||
events_per_second: Arc<std::sync::atomic::AtomicU64>,
|
||||
/// Last performance check
|
||||
@@ -200,7 +196,6 @@ impl Default for PerformanceMonitor {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
memory_usage: Arc::new(std::sync::atomic::AtomicUsize::new(0)),
|
||||
cpu_usage: Arc::new(std::sync::atomic::AtomicU64::new(0)),
|
||||
events_per_second: Arc::new(std::sync::atomic::AtomicU64::new(0)),
|
||||
last_check: Arc::new(RwLock::new(None)),
|
||||
}
|
||||
@@ -223,7 +218,6 @@ impl BacktestEngine {
|
||||
Ok(Self {
|
||||
config,
|
||||
market_replay,
|
||||
strategy: None,
|
||||
strategy_tester: None,
|
||||
metrics_calculator,
|
||||
state: Arc::new(RwLock::new(BacktestState::default())),
|
||||
|
||||
@@ -166,8 +166,6 @@ struct MarketState {
|
||||
volume_history: Vec<(DateTime<Utc>, Decimal)>,
|
||||
/// Current position
|
||||
current_position: Option<Position>,
|
||||
/// Last prediction time
|
||||
last_prediction_time: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
impl Default for MarketState {
|
||||
@@ -177,7 +175,6 @@ impl Default for MarketState {
|
||||
price_history: Vec::new(),
|
||||
volume_history: Vec::new(),
|
||||
current_position: None,
|
||||
last_prediction_time: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,8 +209,6 @@ struct PerformanceTracker {
|
||||
peak_value: Decimal,
|
||||
/// Initial capital for equity curve baseline
|
||||
initial_capital: Decimal,
|
||||
/// Model prediction accuracy
|
||||
model_accuracy: HashMap<String, f64>,
|
||||
/// Completed round-trip trade records
|
||||
trade_records: Vec<TradeRecord>,
|
||||
/// Equity snapshots: (timestamp, portfolio_value)
|
||||
@@ -232,7 +227,6 @@ impl Default for PerformanceTracker {
|
||||
current_drawdown: Decimal::ZERO,
|
||||
peak_value: Decimal::ZERO,
|
||||
initial_capital: Decimal::ZERO,
|
||||
model_accuracy: HashMap::new(),
|
||||
trade_records: Vec::new(),
|
||||
equity_snapshots: Vec::new(),
|
||||
open_entries: HashMap::new(),
|
||||
@@ -243,12 +237,6 @@ impl Default for PerformanceTracker {
|
||||
/// Feature extractor for ML models with object pooling for performance
|
||||
struct FeatureExtractor {
|
||||
config: FeatureSettings,
|
||||
// OPTIMIZATION: Reusable buffers to avoid allocations in hot paths
|
||||
price_buffer: Vec<f64>,
|
||||
volume_buffer: Vec<f64>,
|
||||
returns_buffer: Vec<f64>,
|
||||
gains_buffer: Vec<f64>,
|
||||
losses_buffer: Vec<f64>,
|
||||
}
|
||||
|
||||
impl FeatureExtractor {
|
||||
@@ -258,16 +246,10 @@ impl FeatureExtractor {
|
||||
/// * `config` - Feature extraction configuration
|
||||
///
|
||||
/// # Returns
|
||||
/// * `Self` - New feature extractor instance with pre-allocated buffers
|
||||
/// * `Self` - New feature extractor instance
|
||||
fn new(config: FeatureSettings) -> Self {
|
||||
Self {
|
||||
config,
|
||||
// Pre-allocate buffers with reasonable capacity
|
||||
price_buffer: Vec::with_capacity(1024),
|
||||
volume_buffer: Vec::with_capacity(1024),
|
||||
returns_buffer: Vec::with_capacity(1024),
|
||||
gains_buffer: Vec::with_capacity(1024),
|
||||
losses_buffer: Vec::with_capacity(1024),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -291,8 +291,6 @@ pub struct Account {
|
||||
pub struct OrderManager {
|
||||
/// Open orders
|
||||
orders: DashMap<OrderId, Order>,
|
||||
/// Order history
|
||||
order_history: RwLock<Vec<Order>>,
|
||||
/// Next order ID
|
||||
next_order_id: std::sync::atomic::AtomicU64,
|
||||
}
|
||||
@@ -765,7 +763,6 @@ impl OrderManager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
orders: DashMap::new(),
|
||||
order_history: RwLock::new(Vec::new()),
|
||||
next_order_id: std::sync::atomic::AtomicU64::new(1),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user