Overall Statistics
Total Trades
197
Average Win
2.17%
Average Loss
-0.07%
Compounding Annual Return
29.399%
Drawdown
32.500%
Expectancy
31.924
Net Profit
1398.326%
Sharpe Ratio
1.614
Probabilistic Sharpe Ratio
89.820%
Loss Rate
1%
Win Rate
99%
Profit-Loss Ratio
32.25
Alpha
0.183
Beta
0.885
Annual Standard Deviation
0.198
Annual Variance
0.039
Information Ratio
1.301
Tracking Error
0.127
Treynor Ratio
0.361
Total Fees
$197.65
# Inspired by the theory here:
# https://seekingalpha.com/article/4299701-leveraged-etfs-for-long-term-investing

class Investment(object):
    def __init__(self, symbol, weight):
        self.symbol = symbol
        self.weight = weight

class MultidimensionalTransdimensionalPrism(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2010, 3, 1)
        self.SetCash(1600)
        self.AddEquity("SPY", Resolution.Hour)
        
        self.cashToAdd = 0
        self.investments = [
            Investment("TQQQ", 0.4),
            Investment("TLT", 0.6),
        ]
        
        # Add symbols
        for investment in self.investments:
            self.AddEquity(investment.symbol, Resolution.Hour)
        
        # Schedules
        self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY", 150), self.Rebalance)
        self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY", 140), self.AddCash)

    def OnData(self, data):
        pass       
        
    def Rebalance(self):
        for investment in self.investments:
            self.SetHoldings(investment.symbol, investment.weight)
            
    def AddCash(self):
        self.Portfolio.SetCash(self.Portfolio.Cash + self.cashToAdd)