Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
6.104%
Drawdown
0.400%
Expectancy
0
Net Profit
0.064%
Sharpe Ratio
1.087
Probabilistic Sharpe Ratio
50.282%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.986
Beta
-0.202
Annual Standard Deviation
0.034
Annual Variance
0.001
Information Ratio
-38.925
Tracking Error
0.12
Treynor Ratio
-0.184
Total Fees
$0.00
class BasicTemplateCryptoAlgorithm(QCAlgorithm):


    def Initialize(self):
        self.SetStartDate(2021, 1, 4) #Set Start Date
        self.SetEndDate(2021, 1, 7) #Set End Date
        self.SetCash(10000)
        self.SetCash("EUR", 10000)
        self.SetCash("BTC", 0)
        self.SetCash("ETH", 0)
        self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
        # Find more symbols here: http://quantconnect.com/data
        self.AddCrypto("BTCUSD", Resolution.Hour)
        self.AddCrypto("ETHUSD", Resolution.Hour)
        self.AddCrypto("BTCEUR", Resolution.Hour)
        self.AddCrypto("LTCUSD", Resolution.Hour)
        
        self.window = RollingWindow[TradeBar](2)
        
        self.sma = self.SMA("LTCUSD", 50, Resolution.Hour)
        self.sma.Updated += self.SmaUpdated
        self.smaWindow = RollingWindow[IndicatorDataPoint](21)
        
        
        self.SetWarmup(60)
        self.first = True
    
    def SmaUpdated(self, sender, updated):
        self.smaWindow.Add(updated)
    
    
    
    def OnData(self, data):
    
        self.window.Add(self.CurrentSlice.Bars["LTCUSD"])
        
        if not (self.smaWindow.IsReady and self.window.IsReady): return
        
        if self.first and not self.IsWarmingUp:
            self.first = False
            
        self.Log("SMA: {0}".format(self.sma.Samples))
        
        currBar = self.window[0] # Current bar had index zero.
        pastBar = self.window[1] # Past bar has index one.
        self.Log("Price: {0} -> {1} ... {2} -> {3}".format(pastBar.Time, pastBar.Close, currBar.Time, currBar.Close))
        
        currSma = self.smaWindow[0] # Current SMA had index zero.
        pastSma = self.smaWindow[self.smaWindow.Count-1] # Oldest SMA has index of window count minus 1.
        self.Log("SMA: {0} -> {1} ... {2} -> {3}".format(pastSma.Time, pastSma.Value, currSma.Time, currSma.Value))