Prevent no last candle error
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user