Fix get current price
This commit is contained in:
@@ -441,12 +441,27 @@ public class EvmManager : IEvmManager
|
||||
}
|
||||
|
||||
if (gmxPrices == null)
|
||||
return null;
|
||||
{
|
||||
Console.WriteLine($"Warning: GMX API returned null for ticker {ticker}, timeframe {timeframe}, startDate {startDate:yyyy-MM-dd HH:mm:ss}");
|
||||
return new List<Candle>();
|
||||
}
|
||||
|
||||
if (gmxPrices.Candles == null || !gmxPrices.Candles.Any())
|
||||
{
|
||||
Console.WriteLine($"Warning: GMX API returned empty candles array for ticker {ticker}, timeframe {timeframe}, startDate {startDate:yyyy-MM-dd HH:mm:ss}");
|
||||
return new List<Candle>();
|
||||
}
|
||||
|
||||
var filteredCandles = gmxPrices.Candles.Where(p => p[0] >= startDate.AddMinutes(-1).ToUnixTimestamp()).ToList();
|
||||
|
||||
if (!filteredCandles.Any())
|
||||
{
|
||||
Console.WriteLine($"Warning: No candles found after filtering for ticker {ticker}, timeframe {timeframe}, startDate {startDate:yyyy-MM-dd HH:mm:ss}. Total candles before filtering: {gmxPrices.Candles.Count}");
|
||||
return new List<Candle>();
|
||||
}
|
||||
|
||||
var candles = new List<Candle>();
|
||||
var timeBetweenCandles =
|
||||
gmxPrices.Candles.Count > 2 ? gmxPrices.Candles[0][0] - gmxPrices.Candles[1][0] : 900; // Default 15 minutes
|
||||
var timeBetweenCandles = CandleHelpers.GetBaseIntervalInSeconds(timeframe);
|
||||
|
||||
for (int i = 0; i < filteredCandles.Count; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user