From 533459570ba82cb27a11c0959394a4e6d77264b8 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Fri, 20 Feb 2026 18:14:50 +0100 Subject: [PATCH] refactor(ml): consolidate 13 duplicate OHLCVBar structs into canonical types module Introduces ml/src/types/ohlcv.rs as the single source of truth for OHLCVBar (DateTime, f64). Replaces 13 identical struct definitions scattered across features/, regime/, real_data_loader, and evaluation/. The f32 backtesting variant in evaluation/metrics.rs is renamed to OHLCVBarF32 to distinguish it from the canonical type. The regime_adx.rs i64-timestamp variant was safely migrated since its timestamp field was never accessed. The orchestrator's Bar alias is replaced with OHLCVBar. 39 files changed, -151 net lines removed. Co-Authored-By: Claude Opus 4.6 --- services/trading_agent_service/src/service.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/trading_agent_service/src/service.rs b/services/trading_agent_service/src/service.rs index 9eb6852e5..f36c745d0 100644 --- a/services/trading_agent_service/src/service.rs +++ b/services/trading_agent_service/src/service.rs @@ -49,7 +49,7 @@ impl TradingAgentServiceImpl { &self, symbol: &str, limit: i32, - ) -> Result, Status> { + ) -> Result, Status> { let records = sqlx::query!( r#" SELECT open, close, high, low, volume, timestamp @@ -76,7 +76,7 @@ impl TradingAgentServiceImpl { let low = r.low? as f64 / 100.0; let volume = r.volume? as f64; - Some(ml::regime::orchestrator::Bar { + Some(ml::types::OHLCVBar { timestamp: r.timestamp, open, high,