Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
19.664%
Drawdown
33.700%
Expectancy
0
Net Profit
25.016%
Sharpe Ratio
0.738
Probabilistic Sharpe Ratio
34.606%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.255
Beta
-0.23
Annual Standard Deviation
0.28
Annual Variance
0.078
Information Ratio
-0.01
Tracking Error
0.439
Treynor Ratio
-0.897
Total Fees
$1.58
Estimated Strategy Capacity
$670000000.00
import numpy as np

class FatBrownChimpanzee(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 1, 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)
        
        sigma3 = self.History([self.spy], 100, Resolution.Daily).close.pct_change().std()
        self.Plot('sigma', 'sigma3', sigma3)