Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
38.477%
Drawdown
9.400%
Expectancy
0
Net Profit
31.145%
Sharpe Ratio
2.017
Probabilistic Sharpe Ratio
75.804%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.361
Beta
-0.105
Annual Standard Deviation
0.162
Annual Variance
0.026
Information Ratio
-0.02
Tracking Error
0.24
Treynor Ratio
-3.093
Total Fees
$1.66
Estimated Strategy Capacity
$870000000.00
import numpy as np

class FatBrownChimpanzee(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 6, 1)  
        self.SetCash(100000)  
        self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.SetWarmUp(100)
        
        
    def OnData(self, data):
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)  
            

    def OnEndOfDay(self):

        sigma1 = np.log1p(self.History([self.spy], 100, Resolution.Daily).close.pct_change()).std()
        self.Plot('sigma', 'sigma1', sigma1)
        
        sigma2 = float(np.diff(np.log(self.History([self.spy], 100, Resolution.Daily).close)).std())
        self.Plot('sigma', 'sigma2', sigma2)