From aa130e9554d18f1a3b68ea5d3dc461e1b9952df5 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Sat, 21 Feb 2026 23:33:14 +0100 Subject: [PATCH] feat(backtesting_service): wire equity curve total_count and add stop_backtest logging - Replace hardcoded `total_count: 0` with `summaries.len() as u32` in list_backtests - Add tracing::warn! in get_backtest_results when equity_curve is returned empty - Add tracing::warn! in stop_backtest noting task cancellation is not yet implemented - Import `warn` from tracing alongside existing debug/error/info imports Co-Authored-By: Claude Opus 4.6 --- services/backtesting_service/src/service.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/services/backtesting_service/src/service.rs b/services/backtesting_service/src/service.rs index eb962dd92..aca8117ff 100644 --- a/services/backtesting_service/src/service.rs +++ b/services/backtesting_service/src/service.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use std::sync::Arc; use tokio::sync::{broadcast, RwLock}; use tonic::{Request, Response, Status}; -use tracing::{debug, error, info}; +use tracing::{debug, error, info, warn}; use uuid::Uuid; use crate::foxhunt::tli::{backtesting_service_server::BacktestingService, *}; @@ -570,7 +570,10 @@ impl BacktestingService for BacktestingServiceImpl { backtest_id: req.backtest_id, metrics: proto_metrics, trades: proto_trades, - equity_curve: Vec::new(), // TODO: Implement equity curve + equity_curve: { + warn!("Equity curve not yet populated from backtest results"); + Vec::new() + }, // TODO: Implement equity curve drawdown_periods: Vec::new(), // TODO: Implement drawdown periods })) } @@ -593,10 +596,11 @@ impl BacktestingService for BacktestingServiceImpl { .map_err(|e| Status::internal(format!("Failed to list backtests: {}", e)))?; let summaries: Vec = backtests.into_iter().map(|bt| bt.into()).collect(); + let total_count = summaries.len() as u32; Ok(Response::new(ListBacktestsResponse { backtests: summaries, - total_count: 0, // TODO: Implement total count + total_count, })) } @@ -655,7 +659,12 @@ impl BacktestingService for BacktestingServiceImpl { } } - // TODO: Actually stop the running backtest task + // Task cancellation not yet implemented — the spawned tokio task will run to completion. + // When a CancellationToken or JoinHandle is stored in BacktestContext this can be wired up. + warn!( + "stop_backtest: task cancellation not yet implemented for {}", + req.backtest_id + ); Ok(Response::new(StopBacktestResponse { success: true,