Update vitejs + fix bot saving

This commit is contained in:
2025-05-11 20:23:06 +07:00
parent 65c4ec4957
commit 84e09b32a2
20 changed files with 220 additions and 238 deletions

View File

@@ -130,24 +130,34 @@ public static class MongoMappers
if (b == null)
return null;
var config = new TradingBotConfig
{
AccountName = b.AccountName,
Ticker = b.Ticker,
ScenarioName = b.ScenarioName,
Timeframe = b.Timeframe,
IsForWatchingOnly = b.IsForWatchingOnly,
BotTradingBalance = b.BotTradingBalance,
BotType = b.BotType,
IsForBacktest = b.IsForBacktest,
CooldownPeriod = b.CooldownPeriod,
MaxLossStreak = b.MaxLossStreak,
MoneyManagement = Map(b.MoneyManagement)
};
var bTest = new Backtest(
b.Ticker,
b.Scenario,
config,
b.Positions?.Select(p => Map(p)).ToList() ?? new List<Position>(),
b.Signals?.Select(s => Map(s)).ToList() ?? new List<Signal>(),
b.Timeframe,
b.Candles?.Select(c => Map(c)).ToList() ?? new List<Candle>(),
b.BotType,
b.AccountName)
b.Candles?.Select(c => Map(c)).ToList() ?? new List<Candle>())
{
FinalPnl = b.FinalPnl,
WinRate = b.WinRate,
GrowthPercentage = b.GrowthPercentage,
HodlPercentage = b.HodlPercentage,
Id = b.Id.ToString(),
MoneyManagement = Map(b.MoneyManagement),
OptimizedMoneyManagement = Map(b.OptimizedMoneyManagement),
User = b.User != null ? Map(b.User) : null,
User = Map(b.User),
Statistics = b.Statistics,
StartDate = b.StartDate,
EndDate = b.EndDate,
@@ -171,18 +181,24 @@ public static class MongoMappers
HodlPercentage = result.HodlPercentage,
Positions = Map(result.Positions),
Signals = result.Signals.Select(s => Map(s)).ToList(),
Ticker = result.Ticker,
Scenario = result.Scenario,
AccountName = result.AccountName,
BotType = result.BotType,
Timeframe = result.Timeframe,
MoneyManagement = Map(result.MoneyManagement),
Candles = result.Candles.Select(c => Map(c)).ToList(),
MoneyManagement = Map(result.Config.MoneyManagement),
OptimizedMoneyManagement = Map(result.OptimizedMoneyManagement),
User = result.User != null ? Map(result.User) : null,
User = Map(result.User),
Statistics = result.Statistics,
StartDate = result.StartDate,
EndDate = result.EndDate,
Score = result.Score
Score = result.Score,
AccountName = result.Config.AccountName,
Ticker = result.Config.Ticker,
ScenarioName = result.Config.ScenarioName,
Timeframe = result.Config.Timeframe,
IsForWatchingOnly = result.Config.IsForWatchingOnly,
BotTradingBalance = result.Config.BotTradingBalance,
BotType = result.Config.BotType,
IsForBacktest = result.Config.IsForBacktest,
CooldownPeriod = result.Config.CooldownPeriod,
MaxLossStreak = result.Config.MaxLossStreak
};
}