Add backtest light

This commit is contained in:
2025-07-17 05:19:16 +07:00
parent 6a634eafaa
commit 27bed791c3
16 changed files with 181 additions and 270 deletions

View File

@@ -179,7 +179,21 @@ public class BacktestController : BaseController
var response = new PaginatedBacktestsResponse
{
Backtests = backtests,
Backtests = backtests.Select(b => 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.MaxDrawdown,
Fees = b.Fees,
SharpeRatio = b.SharpeRatio,
Score = b.Score
}),
TotalCount = totalCount,
CurrentPage = page,
PageSize = pageSize,
@@ -229,7 +243,21 @@ public class BacktestController : BaseController
var response = new PaginatedBacktestsResponse
{
Backtests = backtests,
Backtests = backtests.Select(b => 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.MaxDrawdown,
Fees = b.Fees,
SharpeRatio = b.SharpeRatio,
Score = b.Score
}),
TotalCount = totalCount,
CurrentPage = page,
PageSize = pageSize,

View File

@@ -0,0 +1,19 @@
using Managing.Domain.Bots;
namespace Managing.Api.Models.Requests;
public class LightBacktestResponse
{
public string Id { get; set; } = string.Empty;
public TradingBotConfig Config { get; set; } = new();
public decimal FinalPnl { get; set; }
public int WinRate { get; set; }
public decimal GrowthPercentage { get; set; }
public decimal HodlPercentage { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public decimal? MaxDrawdown { get; set; }
public decimal Fees { get; set; }
public double? SharpeRatio { get; set; }
public double Score { get; set; }
}

View File

@@ -1,5 +1,3 @@
using Managing.Domain.Backtests;
namespace Managing.Api.Models.Requests;
/// <summary>
@@ -10,7 +8,7 @@ public class PaginatedBacktestsResponse
/// <summary>
/// The list of backtests for the current page
/// </summary>
public IEnumerable<Backtest> Backtests { get; set; } = new List<Backtest>();
public IEnumerable<LightBacktestResponse> Backtests { get; set; } = new List<LightBacktestResponse>();
/// <summary>
/// Total number of backtests across all pages