24 internal sealed
class AnnualReturnsReportElement : ChartReportElement
47 public override string Render()
52 var backtestTime = backtestReturns.Keys.ToList();
53 var backtestStrategy = backtestReturns.Values.ToList();
55 var liveTime = liveReturns.Keys.ToList();
56 var liveStrategy = liveReturns.Values.ToList();
61 var backtestList =
new PyList();
62 var liveList =
new PyList();
74 var backtestAnnualReturns = backtestSeries.ResampleEquivalence(date =>
new DateTime(date.Year, 1, 1), agg => agg.TotalReturns() * 100).DropMissing();
83 var liveAnnualReturns = liveSeries.ResampleEquivalence(date =>
new DateTime(date.Year, 1, 1), agg => agg.TotalReturns() * 100).DropMissing();
86 backtestList.Append(backtestAnnualReturns.Keys.Select(x => x.Year).ToList().ToPython());
87 backtestList.Append(backtestAnnualReturns.Values.ToList().ToPython());
88 liveList.Append(liveAnnualReturns.Keys.Select(x => x.Year).ToList().ToPython());
89 liveList.Append(liveAnnualReturns.Values.ToList().ToPython());
91 base64 = Charting.GetAnnualReturns(backtestList, liveList);