Add logs for BacktestExecutor.cs
This commit is contained in:
@@ -483,34 +483,12 @@ public class BacktestExecutor
|
||||
string.Join(", ", bottlenecks));
|
||||
}
|
||||
|
||||
_logger.LogInformation("🎯 Backtest completed successfully - RequestId: {RequestId}", finalRequestId);
|
||||
_logger.LogInformation("🎯 Backtest completed successfully - RequestId: {RequestId} - Score: {Score} - Realized PnL: {RealizedPnl} - Net PnL: {NetPnl}", finalRequestId, result.Score, result.FinalPnl, result.NetPnl);
|
||||
|
||||
// Convert Backtest to LightBacktest
|
||||
return ConvertToLightBacktest(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advanced signal caching based on indicator update frequency
|
||||
/// Instead of hashing candles, we cache signals based on how often indicators need updates
|
||||
/// </summary>
|
||||
private bool ShouldSkipSignalUpdate(int currentCandleIndex, int totalCandles)
|
||||
{
|
||||
// RSI and similar indicators don't need to be recalculated every candle
|
||||
// For 15-minute candles, we can update signals every 3-5 candles without significant accuracy loss
|
||||
const int signalUpdateFrequency = 3; // Update signals every N candles
|
||||
|
||||
// Always update signals for the first few candles to establish baseline
|
||||
if (currentCandleIndex < 10)
|
||||
return false;
|
||||
|
||||
// Always update signals near the end to ensure final trades are calculated
|
||||
if (currentCandleIndex > totalCandles - 10)
|
||||
return false;
|
||||
|
||||
// Skip signal updates based on frequency
|
||||
return (currentCandleIndex % signalUpdateFrequency) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pre-calculates all signals for the entire backtest period
|
||||
/// This eliminates repeated GetSignal() calls during the backtest loop
|
||||
|
||||
Reference in New Issue
Block a user