Overall Statistics |
Total Trades 13 Average Win 0.31% Average Loss -0.01% Compounding Annual Return 8.533% Drawdown 17.000% Expectancy 37.385 Net Profit 21.051% Sharpe Ratio 1.097 Probabilistic Sharpe Ratio 52.934% Loss Rate 33% Win Rate 67% Profit-Loss Ratio 56.58 Alpha 0.079 Beta 0.134 Annual Standard Deviation 0.081 Annual Variance 0.007 Information Ratio 0.059 Tracking Error 0.223 Treynor Ratio 0.663 Total Fees $15.11 |
from datetime import datetime from collections import * ### <summary> ### All Weather Strategy (Dalio) ### #https://www.iwillteachyoutoberich.com/blog/all-weather-portfolio/ ### </summary>> class AllWeatherStrategy(QCAlgorithm): def Initialize(self): self.SetStartDate(2018, 1, 1) self.SetEndDate(2020, 5, 1) self.SetCash(100000) # Country index ETFs according to https://seekingalpha.com/etfs-and-funds/etf-tables/countries self.etfs = [ (self.AddEquity('VTI', Resolution.Minute).Symbol, 0.3), #Vanguard Total Stock Market ETF (self.AddEquity('TLT', Resolution.Minute).Symbol, 0.4), # iShares 20+ Year Treasury ETF (TLT) (self.AddEquity('IEF', Resolution.Minute).Symbol, 0.15), #iShares 7 – 10 Year Treasury ETF (IEF) (self.AddEquity('GLD', Resolution.Minute).Symbol, 0.075), #SPDR Gold Shares ETF (GLD), #SPDR Gold Shares (GLD) (self.AddEquity('DBC', Resolution.Minute).Symbol, 0.075) # PowerShares DB Commodity Index Tracking Fund (DBC)" ] self.Schedule.On(self.DateRules.MonthStart(self.etfs[0][0]), \ self.TimeRules.BeforeMarketClose(self.etfs[0][0]), self.Rebalance) self.leverage = 1.0 self.monthCounter = 12 def OnData(self, data): pass def Rebalance(self): if self.monthCounter == 12: self.SetHoldings([PortfolioTarget(etf,target*self.leverage) for etf,target in self.etfs]) self.monthCounter = 1 else: self.monthCounter += 1