Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 44.014% Drawdown 42.700% Expectancy 0 Net Profit 190.733% Sharpe Ratio 1.28 Probabilistic Sharpe Ratio 54.913% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.455 Beta -0.228 Annual Standard Deviation 0.332 Annual Variance 0.11 Information Ratio 0.7 Tracking Error 0.417 Treynor Ratio -1.866 Total Fees $12.97 |
class PerformanceComparisonStrategyWithBenchmark(QCAlgorithm): def Initialize(self): self.SetStartDate(2018, 1, 1) self.InitCash = 100000 self.SetCash(self.InitCash) self.MKT = self.AddEquity("SPY", Resolution.Daily).Symbol self.spy = [] self.arkk = self.AddEquity("ARKK", Resolution.Daily).Symbol self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.BeforeMarketClose('SPY', 0), self.record_vars) def OnData(self, data): if not self.Portfolio.Invested: self.SetHoldings("ARKK", 1) def record_vars(self): hist = self.History(self.MKT, 2, Resolution.Daily)['close'].unstack(level= 0).dropna() self.spy.append(hist[self.MKT].iloc[-1]) spy_perf = self.spy[-1] / self.spy[0] * self.InitCash self.Plot('Strategy Equity', 'SPY', spy_perf)