Overall Statistics |
Total Trades 39 Average Win 0.03% Average Loss -0.03% Compounding Annual Return -32.359% Drawdown 22.900% Expectancy 0.130 Net Profit -22.830% Sharpe Ratio -5.086 Probabilistic Sharpe Ratio 0.000% Loss Rate 39% Win Rate 61% Profit-Loss Ratio 0.86 Alpha -0.274 Beta -0.008 Annual Standard Deviation 0.054 Annual Variance 0.003 Information Ratio -0.761 Tracking Error 0.199 Treynor Ratio 33.302 Total Fees $41.07 |
### <summary> ### All Weather Strategy (Dalio) ### https://www.iwillteachyoutoberich.com/blog/all-weather-portfolio/ ### </summary>> class AllWeatherStrategy(QCAlgorithm): def Initialize(self): self.SetStartDate(2008, 1, 1) self.SetEndDate(2008, 8, 31) self.SetCash(100000) self.monthCounter = 0 self.etfs = [ (self.AddEquity('SPY', Resolution.Daily).Symbol,0.3), #S&P 500 (self.AddEquity('TLT', Resolution.Daily).Symbol,0.4), #iShares 20+ Year Treasury ETF (TLT) / EU alternative: IS04 https://www.ishares.com/de/privatanleger/de/produkte/272124/ishares-usd-treasury-bond-20-yr-ucits-etf (self.AddEquity('IEF', Resolution.Daily).Symbol,0.15), #iShares 7 – 10 Year Treasury ETF (IEF) / EU alternative: IBTM https://www.ishares.com/uk/individual/en/products/251716/ishares-treasury-bond-710yr-ucits-etf (self.AddEquity('GLD', Resolution.Daily).Symbol,0.075), #SPDR Gold Shares ETF (GLD), #SPDR Gold Shares (GLD) / EU alternative: IS0E https://www.ishares.com/de/privatanleger/de/produkte/251908/ishares-gold-producers-ucits-etf (self.AddEquity('VPU', Resolution.Daily).Symbol,0.075) #Vanguard Utilities Index Fund ETF / EU alternative: IUUS https://www.ishares.com/uk/individual/en/products/287115/ishares-s-p-500-utilities-sector-ucits-etf-fund ] self.Schedule.On(self.DateRules.MonthStart(self.etfs[0][0]), self.TimeRules.AfterMarketOpen(self.etfs[0][0]), self.Rebalance) self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(0, 0), self.Withdraw) self.leverage = 1 self.buffer = 0.1 def Withdraw(self): withdraw_amount = self.Portfolio.TotalPortfolioValue * 0.001 current_cash = self.Portfolio.CashBook[self.AccountCurrency].Amount self.Portfolio.CashBook.Add(self.AccountCurrency, current_cash - withdraw_amount, 1) def Rebalance(self): self.SetHoldings([PortfolioTarget(etf, target*self.leverage*(1 - self.buffer)) for etf, target in self.etfs]) self.Plot("Custom", "Cash", self.Portfolio.Cash)