Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
47.653%
Drawdown
42.700%
Expectancy
0
Net Profit
222.250%
Sharpe Ratio
1.371
Probabilistic Sharpe Ratio
59.546%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.485
Beta
-0.221
Annual Standard Deviation
0.332
Annual Variance
0.11
Information Ratio
0.769
Tracking Error
0.415
Treynor Ratio
-2.055
Total Fees
$12.97
class PerformanceComparisonStrategyWithBenchmark(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2018, 1, 1)
        # self.SetEndDate(2021, 1, 3)
        self.InitCash = 100000
        self.SetCash(self.InitCash)  
        self.MKT = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.mkt = []
        
        self.stk = self.AddEquity("ARKK", Resolution.Daily).Symbol
        
        
    def OnData(self, data):
        
        if not self.Portfolio.Invested:
            self.SetHoldings(self.stk, 1)
            
            
    def OnEndOfDay(self):  
    
        mkt_price = self.History(self.MKT, 2, Resolution.Daily)['close'].unstack(level= 0).iloc[-1]
        self.mkt.append(mkt_price)
        mkt_perf = self.InitCash * self.mkt[-1] / self.mkt[0] 
        self.Plot('Strategy Equity', self.MKT, mkt_perf)