Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
19.316%
Drawdown
33.700%
Expectancy
0
Net Profit
24.684%
Sharpe Ratio
0.728
Probabilistic Sharpe Ratio
34.205%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.251
Beta
-0.23
Annual Standard Deviation
0.279
Annual Variance
0.078
Information Ratio
-0.009
Tracking Error
0.438
Treynor Ratio
-0.883
Total Fees
$1.58
Estimated Strategy Capacity
$670000000.00
import numpy as np

class StandardDeviation_test(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 1, 1)  
        self.SetCash(100000)  
        self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.SetWarmUp(101)
        
        self.std = StandardDeviation("SPY", 100) 
        self.std_short = self.STD("SPY", 100, Resolution.Daily)
        
        

    def OnData(self, data):
        if self.IsWarmingUp: return
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)
            
            
    def OnEndOfDay(self):
        if self.IsWarmingUp: return
        self.std.Update(self.Time, self.Securities[self.spy].Close)
        self.Plot('StandardDeviation', "StandardDeviation",float(self.std.Current.Value))
        self.Plot('STD', "STD", float(self.std_short.Current.Value))
        
        std = self.History([self.spy], 100, Resolution.Daily).close.std()
        self.Plot('std', 'std', float(std))