Prevent no last candle error

This commit is contained in:
2025-10-11 13:59:09 +07:00
parent e917edd939
commit e3f2577db4

View File

@@ -498,6 +498,12 @@ public class EvmManager : IEvmManager
{
var lastCandles = await GetCandles(ticker, DateTime.UtcNow.AddMinutes(-5),
Timeframe.OneMinute);
if (lastCandles == null || !lastCandles.Any())
{
throw new InvalidOperationException($"No candles found for ticker {ticker}. Unable to get the latest candle data.");
}
return lastCandles.Last();
}