Add signalr

This commit is contained in:
2025-07-21 19:54:04 +07:00
parent a32e9c33a8
commit 83ed78a1fa
11 changed files with 441 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Managing.Domain.Backtests;
using Managing.Domain.Bots;
namespace Managing.Api.Models.Requests;
@@ -19,4 +20,28 @@ public class LightBacktestResponse
[Required] public double? SharpeRatio { get; set; }
[Required] public double Score { get; set; }
[Required] public string ScoreMessage { get; set; } = string.Empty;
}
public static class LightBacktestResponseMapper
{
public static LightBacktestResponse MapFromDomain(Backtest b)
{
if (b == null) return null;
return new LightBacktestResponse
{
Id = b.Id,
Config = b.Config,
FinalPnl = b.FinalPnl,
WinRate = b.WinRate,
GrowthPercentage = b.GrowthPercentage,
HodlPercentage = b.HodlPercentage,
StartDate = b.StartDate,
EndDate = b.EndDate,
MaxDrawdown = b.Statistics?.MaxDrawdown,
Fees = b.Fees,
SharpeRatio = (double?)b.Statistics?.SharpeRatio,
Score = b.Score,
ScoreMessage = b.ScoreMessage
};
}
}