Files
foxhunt/price_decimal_fix.patch
jgrusewski 72f607759a 🔧 Fix import paths: Remove non-existent prelude module references
- Fixed 101+ files importing common::types::prelude which doesn't exist
- Changed all imports to use common::types directly
- Fixed BarEvent duplicate import in data/src/types.rs
- Aligned all imports with canonical type system in common crate
2025-09-26 19:53:00 +02:00

26 lines
731 B
Diff

// CRITICAL PRICE/DECIMAL TYPE FIXES - Agent 16
// 1. Add missing From<Price> for Decimal trait implementation
impl From<Price> for Decimal {
fn from(price: Price) -> Self {
price.to_decimal().unwrap_or_else(|_| {
eprintln!("Failed to convert Price to Decimal, using ZERO as fallback");
Decimal::ZERO
})
}
}
// 2. Add value() method extension for Decimal compatibility
pub trait DecimalExtensions {
fn value(&self) -> Self;
}
impl DecimalExtensions for Decimal {
fn value(&self) -> Self {
*self
}
}
// 3. Position struct field corrections
// Fix: Position.avg_cost should be Position.avg_price
// Fix: Volume::new() returns Result, need to handle properly