| Overall Statistics |
|
Total Trades 207 Average Win 2.45% Average Loss -0.02% Compounding Annual Return 34.151% Drawdown 39.000% Expectancy 103.972 Net Profit 2088.426% Sharpe Ratio 1.529 Probabilistic Sharpe Ratio 82.448% Loss Rate 1% Win Rate 99% Profit-Loss Ratio 105.01 Alpha 0.195 Beta 1.224 Annual Standard Deviation 0.252 Annual Variance 0.063 Information Ratio 1.637 Tracking Error 0.141 Treynor Ratio 0.314 Total Fees $208.07 |
# 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.5),
Investment("TLT", 0.5),
]
# 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)