Fix backtest

This commit is contained in:
2025-04-29 01:17:58 +07:00
parent 204bd87e6a
commit f91b12fbcc
14 changed files with 113 additions and 92 deletions

View File

@@ -28,7 +28,7 @@ public class BotRepository : IBotRepository
public async Task UpdateBackupBot(BotBackup bot)
{
var b = await _botRepository.FindOneAsync(b => b.Name == bot.Name);
var b = await _botRepository.FindOneAsync(b => b.Identifier == bot.Identifier);
var dto = MongoMappers.Map(bot);
dto.Id = b.Id;
_botRepository.Update(dto);

View File

@@ -10,4 +10,6 @@ public class BotDto : Document
public string Name { get; set; }
public string Data { get; set; }
public BotType BotType { get; set; }
public string Identifier { get; set; }
public UserDto User { get; set; }
}

View File

@@ -720,7 +720,8 @@ public static class MongoMappers
return new BotDto
{
Name = bot.Name,
User = Map(bot.User),
Identifier = bot.Identifier,
BotType = bot.BotType,
Data = bot.Data,
};
@@ -732,7 +733,8 @@ public static class MongoMappers
return new BotBackup
{
Name = b.Name,
User = Map(b.User),
Identifier = b.Identifier,
BotType = b.BotType,
Data = b.Data
};

View File

@@ -197,7 +197,7 @@ public class TradingRepository : ITradingRepository
public void UpdatePosition(Position position)
{
var p = _positionRepository.FindOne(p => p.Open.ExchangeOrderId == position.Open.ExchangeOrderId);
var p = _positionRepository.FindOne(p => p.Identifier.Equals(position.Identifier));
var dto = MongoMappers.Map(position);
dto.Id = p.Id;
_positionRepository.Update(dto);