diff --git a/Cargo.lock b/Cargo.lock index 292294cff..cc205eeb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1691,6 +1691,7 @@ dependencies = [ "num-bigint 0.4.6", "num-integer", "num-traits", + "serde", ] [[package]] @@ -10350,6 +10351,7 @@ dependencies = [ "axum 0.7.9", "base32", "base64 0.22.1", + "bigdecimal", "bytes", "chrono", "clap 4.5.48", diff --git a/Cargo.toml b/Cargo.toml index 539427700..4271689be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -179,6 +179,7 @@ chrono = { version = "0.4.38", features = ["serde"] } # Financial and numerical types rust_decimal = { version = "1.0", features = ["serde", "macros", "maths"] } rust_decimal_macros = "1.36" +bigdecimal = { version = "0.4", features = ["serde"] } num-bigint = "0.4" num-traits = "0.2" num = "0.4" diff --git a/services/trading_service/.sqlx/query-ed65aff35d7e51bb05f3daf9deba262c1e09aedf61db2fffef360de9cfc92cbb.json b/services/trading_service/.sqlx/query-3ca32dd6e45c3555cace74aba6341e745761b341b5a186296875ddd88898ce56.json similarity index 60% rename from services/trading_service/.sqlx/query-ed65aff35d7e51bb05f3daf9deba262c1e09aedf61db2fffef360de9cfc92cbb.json rename to services/trading_service/.sqlx/query-3ca32dd6e45c3555cace74aba6341e745761b341b5a186296875ddd88898ce56.json index d4a6432a6..d7cb3899c 100644 --- a/services/trading_service/.sqlx/query-ed65aff35d7e51bb05f3daf9deba262c1e09aedf61db2fffef360de9cfc92cbb.json +++ b/services/trading_service/.sqlx/query-3ca32dd6e45c3555cace74aba6341e745761b341b5a186296875ddd88898ce56.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE ml_predictions\n SET actual_action = $1, pnl = $2::numeric, outcome_recorded_at = $3\n WHERE id = $4\n ", + "query": "\n UPDATE ml_predictions\n SET actual_action = $1, pnl = $2, outcome_recorded_at = $3\n WHERE id = $4\n ", "describe": { "columns": [], "parameters": { @@ -13,5 +13,5 @@ }, "nullable": [] }, - "hash": "ed65aff35d7e51bb05f3daf9deba262c1e09aedf61db2fffef360de9cfc92cbb" + "hash": "3ca32dd6e45c3555cace74aba6341e745761b341b5a186296875ddd88898ce56" } diff --git a/services/trading_service/Cargo.toml b/services/trading_service/Cargo.toml index e3ca90cff..b8c3a7252 100644 --- a/services/trading_service/Cargo.toml +++ b/services/trading_service/Cargo.toml @@ -76,6 +76,7 @@ md5.workspace = true hostname = "0.4" num-traits.workspace = true rust_decimal.workspace = true +bigdecimal.workspace = true rand.workspace = true sysinfo = "0.33" log.workspace = true diff --git a/services/trading_service/src/ml_performance_metrics.rs b/services/trading_service/src/ml_performance_metrics.rs index 4ace6313d..5498a96b2 100644 --- a/services/trading_service/src/ml_performance_metrics.rs +++ b/services/trading_service/src/ml_performance_metrics.rs @@ -107,7 +107,7 @@ impl MLMetricsStore { sqlx::query!( r#" UPDATE ml_predictions - SET actual_action = $1, pnl = $2::numeric, outcome_recorded_at = $3 + SET actual_action = $1, pnl = $2, outcome_recorded_at = $3 WHERE id = $4 "#, outcome.actual_action,