Add score
This commit is contained in:
@@ -164,6 +164,23 @@ namespace Managing.Application.Backtesting
|
||||
var stats = TradingHelpers.GetStatistics(bot.WalletBalances);
|
||||
var growthPercentage = TradingHelpers.GetGrowthFromInitalBalance(balance, finalPnl);
|
||||
var hodlPercentage = TradingHelpers.GetHodlPercentage(candles[0], candles.Last());
|
||||
|
||||
var scoringParams = new BacktestScoringParams(
|
||||
sharpeRatio: (double)stats.SharpeRatio,
|
||||
maxDrawdownPc: (double)stats.MaxDrawdownPc,
|
||||
growthPercentage: (double)growthPercentage,
|
||||
hodlPercentage: (double)hodlPercentage,
|
||||
winRate: winRate,
|
||||
totalPnL: (double)finalPnl,
|
||||
fees: (double)bot.GetTotalFees(),
|
||||
tradeCount: bot.Positions.Count,
|
||||
maxDrawdownRecoveryTime: stats.MaxDrawdownRecoveryTime
|
||||
);
|
||||
|
||||
// Then calculate the score
|
||||
var score = BacktestScorer.CalculateTotalScore(scoringParams);
|
||||
|
||||
|
||||
var result = new Backtest(ticker, scenario.Name, bot.Positions, bot.Signals.ToList(), timeframe, candles,
|
||||
bot.BotType, account.Name)
|
||||
{
|
||||
@@ -176,9 +193,11 @@ namespace Managing.Application.Backtesting
|
||||
Statistics = stats,
|
||||
OptimizedMoneyManagement = optimizedMoneyManagement,
|
||||
MoneyManagement = moneyManagement,
|
||||
StrategiesValues = AggregateValues(strategiesValues, bot.StrategiesValues)
|
||||
StrategiesValues = AggregateValues(strategiesValues, bot.StrategiesValues),
|
||||
Score = score
|
||||
};
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user