Add todo for backtest performance

This commit is contained in:
2025-11-15 20:53:08 +07:00
parent 49a693b44a
commit 428e36d744
4 changed files with 173 additions and 0 deletions

View File

@@ -264,6 +264,8 @@ public class BacktestExecutor
// Run with optimized backtest path (minimize async calls)
var signalUpdateStart = Stopwatch.GetTimestamp();
// Convert rolling window to HashSet for TradingBot.UpdateSignals compatibility
// NOTE: Recreating HashSet each iteration is necessary to maintain correct enumeration order
// Incremental updates break business logic (changes PnL results)
var fixedCandles = new HashSet<Candle>(rollingWindowCandles);
await tradingBot.UpdateSignals(fixedCandles, preCalculatedIndicatorValues);
signalUpdateTotalTime += Stopwatch.GetElapsedTime(signalUpdateStart);