23 internal sealed
class PSRReportElement : ReportElement
31 private int _tradingDaysPerYear;
47 _tradingDaysPerYear = tradingDaysPerYear;
53 public override string Render()
58 psr = _backtest?.
TotalPerformance?.PortfolioStatistics?.ProbabilisticSharpeRatio;
68 var equityCurvePerformance = DrawdownCollection.NormalizeResults(_backtest, _live)
69 .ResampleEquivalence(date => date.Date, s => s.LastValue())
72 if (equityCurvePerformance.IsEmpty || equityCurvePerformance.KeyCount < 180)
77 var sixMonthsBefore = equityCurvePerformance.LastKey() - TimeSpan.FromDays(180);
79 var benchmarkSharpeRatio = 1.0d / Math.Sqrt(_tradingDaysPerYear);
80 psr = Statistics.Statistics.ProbabilisticSharpeRatio(
81 equityCurvePerformance
82 .Where(kvp => kvp.Key >= sixMonthsBefore)