- 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
26 lines
731 B
Diff
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
|