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
-4.585
Tracking Error
0.094
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
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.SetEndDate(2020, 8, 15)
        self.SetCash(100000)  # Set Strategy Cash
        
        self.day = 0
        
        # list of symbols we want to trade
        self.symbolList = ["BTCUSD","ETHUSD","LTCUSD","BCHUSD"]
        
        # dictionary to hold rolling window for each symbol
        self.latest_daily_bar_by_symbol = {}
        
        self.cryptoSymbols = []
        
        for name in self.symbolList:
            cryptoSymbol = self.AddCrypto(name, Resolution.Minute, Market.GDAX).Symbol
            
            self.cryptoSymbols.append(cryptoSymbol)
            
            dailyConsolidator = TradeBarConsolidator(timedelta(days=1))
            dailyConsolidator.DataConsolidated += self.DailyConsolidator
            self.SubscriptionManager.AddConsolidator(cryptoSymbol, dailyConsolidator)
        
    def DailyConsolidator(self, sender, bar):
        self.latest_daily_bar_by_symbol[bar.Symbol] = bar
        
    
    # Accessing requested data
    def OnData(self, data):
        
        if data.Time.day == self.day:
            return
        self.day = data.Time.day
        
        max_return = -1
        max_symbol = None
        
        for symbol in self.cryptoSymbols: 
            if not data.ContainsKey(symbol) or symbol not in self.latest_daily_bar_by_symbol:
                return
    
            # Acessing previous bar properties from the daily bar
            previous_daily_bar = self.latest_daily_bar_by_symbol[symbol]
            close_to_open_return = (data[symbol].Open - previous_daily_bar.Close) / previous_daily_bar.Close
            
            if close_to_open_return > max_return:
                max_return = close_to_open_return
                max_symbol = symbol
        
        # The symbol with the largest close-to-open return is now available here:
        self.Log(f"Max symbol at {self.Time}: {max_symbol}")