Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0.195
Tracking Error
0.109
Treynor Ratio
0
Total Fees
$0.00
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")

from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Data.Consolidators import *
from datetime import timedelta

class TachyonQuantumAutosequencers(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 7, 20)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        # list of symbols we want to trade
        self.symbolList = ["BTCUSD","ETHUSD","LTCUSD","BCHUSD"]
        
        # dictionary to hold rolling window for each symbol
        self.daily = {}
        self.window = {}
        
        self.cryptoSymbols = []
        
        for name in self.symbolList:
            cryptoSymbol = self.AddCrypto(name, Resolution.Daily, Market.GDAX).Symbol
            
            self.cryptoSymbols.append(cryptoSymbol)
            
            dailyConsolidator = TradeBarConsolidator(timedelta(days=1))
            dailyConsolidator.DataConsolidated += self.DailyConsolidator
            self.SubscriptionManager.AddConsolidator(cryptoSymbol, dailyConsolidator)
            
            self.daily[cryptoSymbol] = RollingWindow[TradeBar](2)
            self.window[cryptoSymbol] = RollingWindow[TradeBar](2)
        
    def DailyConsolidator(self, sender, bar):
        self.daily[bar.Symbol].Add(bar)
        
    
    # Accessing requested data
    def OnData(self, data):
        
        for symbol in self.cryptoSymbols: 
            if not data.ContainsKey(symbol):
                return
    
            self.window[symbol].Add(data.Bars[symbol])
            
            # Access bar properties from the `window`
            if not self.window[symbol].IsReady:
                continue
            latest_bar = self.window[symbol][0]
            close_of_latest_bar = latest_bar.Close
            self.Log(f"Latest `window` close for {symbol}: {close_of_latest_bar}")
            
            # Acessing previous bar properties from the daily bar
            previous_daily_bar = self.daily[symbol][1]
            close_of_previous_daily_bar = previous_daily_bar.Close
            self.Log(f"Previous `daily` close for {symbol}: {close_of_previous_daily_bar}")