diff --git a/services/trading_service/src/ml_performance_metrics.rs b/services/trading_service/src/ml_performance_metrics.rs index 5498a96b2..d6b375d3c 100644 --- a/services/trading_service/src/ml_performance_metrics.rs +++ b/services/trading_service/src/ml_performance_metrics.rs @@ -104,6 +104,9 @@ impl MLMetricsStore { /// # Arguments /// * `outcome` - Prediction outcome to record pub async fn record_outcome(&self, outcome: &PredictionOutcome) -> Result<(), CommonError> { + // Use rust_decimal::Decimal with SQLX (cast to sqlx::types::Decimal alias) + let pnl_value: sqlx::types::Decimal = outcome.pnl; + sqlx::query!( r#" UPDATE ml_predictions @@ -111,7 +114,7 @@ impl MLMetricsStore { WHERE id = $4 "#, outcome.actual_action, - outcome.pnl, + pnl_value as sqlx::types::Decimal, outcome.timestamp, outcome.prediction_id as i32, )