Fix get current price

This commit is contained in:
2025-09-20 16:20:47 +07:00
parent d58672f879
commit 931c4661dc
9 changed files with 110 additions and 12 deletions

View File

@@ -615,7 +615,7 @@ public class TradingBotBase : ITradingBot
await ServiceScopeHelpers.WithScopedService<IExchangeService>(_scopeFactory,
async exchangeService =>
{
currentPrice = await exchangeService.GetPrice(Account, Config.Ticker, DateTime.UtcNow);
currentPrice = await exchangeService.GetCurrentPrice(Account, Config.Ticker);
});
var riskResult = default(SynthRiskResult);
await ServiceScopeHelpers.WithScopedService<ITradingService>(_scopeFactory, async tradingService =>
@@ -664,7 +664,7 @@ public class TradingBotBase : ITradingBot
{
return Config.IsForBacktest
? LastCandle?.Close ?? 0
: await exchangeService.GetPrice(Account, Config.Ticker, DateTime.UtcNow);
: await exchangeService.GetCurrentPrice(Account, Config.Ticker);
});
if (openedPosition != null)
@@ -825,7 +825,7 @@ public class TradingBotBase : ITradingBot
{
currentPrice = Config.IsForBacktest
? LastCandle?.Close ?? 0
: await exchangeService.GetPrice(Account, Config.Ticker, DateTime.UtcNow);
: await exchangeService.GetCurrentPrice(Account, Config.Ticker);
});
@@ -1157,7 +1157,7 @@ public class TradingBotBase : ITradingBot
await ServiceScopeHelpers.WithScopedService<IExchangeService>(_scopeFactory,
async exchangeService =>
{
closingPrice = await exchangeService.GetPrice(Account, Config.Ticker, DateTime.UtcNow);
closingPrice = await exchangeService.GetCurrentPrice(Account, Config.Ticker);
});
bool isManualCloseProfitable = position.OriginDirection == TradeDirection.Long
@@ -1541,7 +1541,7 @@ public class TradingBotBase : ITradingBot
await ServiceScopeHelpers.WithScopedServices<ITradingService, IExchangeService>(_scopeFactory,
async (tradingService, exchangeService) =>
{
var currentPrice = await exchangeService.GetPrice(Account, Config.Ticker, DateTime.UtcNow);
var currentPrice = await exchangeService.GetCurrentPrice(Account, Config.Ticker);
var signalValidationResult = await tradingService.ValidateSynthSignalAsync(
signal,