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 <noreply@anthropic.com>
This commit is contained in:
@@ -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<BacktestSummary> = 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,
|
||||
|
||||
Reference in New Issue
Block a user