Global fix (#9)
* Fix time for candle * Fix out ouf range * Fix pnl, fix custom money management * Clean a bit
This commit is contained in:
@@ -10,7 +10,6 @@ using Managing.Domain.Statistics;
|
||||
using Managing.Domain.Trades;
|
||||
using Managing.Infrastructure.Evm.Abstractions;
|
||||
using Managing.Infrastructure.Evm.Models;
|
||||
using Managing.Infrastructure.Evm.Models.Gmx.v1;
|
||||
using Managing.Infrastructure.Evm.Models.Gmx.v2;
|
||||
using Managing.Infrastructure.Evm.Referentials;
|
||||
using Managing.Infrastructure.Evm.Services;
|
||||
@@ -318,7 +317,7 @@ public class EvmManager : IEvmManager
|
||||
var geckoToken = geckoTokens.FirstOrDefault(x =>
|
||||
string.Equals(x.Symbol, tokens[i].Symbol, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
evmTokens.Add((tokenBalance, geckoToken));
|
||||
evmTokens.Add((tokenBalance, geckoToken)!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,14 +378,16 @@ public class EvmManager : IEvmManager
|
||||
if (gmxPrices == null)
|
||||
return null;
|
||||
|
||||
gmxPrices.Candles = gmxPrices.Candles.Where(p => p[0] >= startDate.ToUnixTimestamp()).ToList();
|
||||
gmxPrices.Candles.RemoveAt(gmxPrices.Candles.Count - 1);
|
||||
var filteredCandles = gmxPrices.Candles.Where(p => p[0] >= startDate.ToUnixTimestamp()).ToList();
|
||||
|
||||
var candles = new List<Candle>();
|
||||
var timeBetweenCandles = gmxPrices.Candles[0][0] - gmxPrices.Candles[1][0];
|
||||
for (int i = 0; i < gmxPrices.Candles.Count; i++)
|
||||
|
||||
var timeBetweenCandles =
|
||||
gmxPrices.Candles.Count > 2 ? gmxPrices.Candles[0][0] - gmxPrices.Candles[1][0] : 900; // Default 15 minutes
|
||||
|
||||
for (int i = 0; i < filteredCandles.Count; i++)
|
||||
{
|
||||
var c = GmxV2Mappers.Map(gmxPrices.Candles[i], ticker, timeframe, (int)timeBetweenCandles);
|
||||
var c = GmxV2Mappers.Map(filteredCandles[i], ticker, timeframe, (int)timeBetweenCandles);
|
||||
candles.Add(c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user