Back to Community
R.I.P Harry Brown - where's my t-shirt?

A variation on Harry Brown's excellent permanent portfolio concept as described in "Fail Safe Investing"
checkout the book or the website crawling road for more info

Clone Algorithm
177
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5074b77abd13412dfa000022
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.
7 responses

Thanks @Fred, this is a particularly interesting algo to share. Your t-shirt is on its way!

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Jean and I were exploring this algo again, and patched up the code to match the latest API. Below is the algo running over a daily bar test through yesterday. Interestingly, the benchmark just recently started out performing.

Clone Algorithm
47
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5179453597534c066d627fe8
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

The "outperformance" seems relative to start date (attached starting at 2005 and the permanent portfolio is much better; starting in 2008 the same) -- is there a more rigourous way to say "the benchmark started outperforming"?

Interesting, the benchmark seems to almost catch up just before a massive market drop :).

Clone Algorithm
40
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 517e9977709ee006c664ee11
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

Just a minor fix to be able to run minute backtest.

Minute backtest was raising a KeyError

That was because of

2005-01-03handle_data:1698ERRORNo data for TLT at 2005-01-03 14:31:00+00:00, skipping processing of bar and continuing.  

so rebalance function was failing and so context.rebalance_date wasn't defined as so if data[context.gold].datetime > context.rebalance_date + datetime.timedelta(days=90): was raising an error : KeyError: 'rebalance_date' There was a runtime error on line 53.

I just changed

context.first_time = False  
rebalance(context, data)  

to

rebalance(context, data)  
context.first_time = False # after rebalancing!  

to fix this

Clone Algorithm
38
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5457db1f0241cb08fe7b2a99
There was a runtime error.

Hello,
I'm new here. Thanks to share your experience abou PP Portfolio.
I had executed your code and there are lot of warning message
Line 25: data[sid(N)] is deprecated. Use data.current. Learn more here.

Is this code always correct ?

Patrick,
Try this simplified version.

# Harry Brown's permanent portfolio  
# ---------------------------------------------------------------------------------  
assets, proportion = symbols('VTI', 'GLD', 'TLT', 'SHY'), [0.25, 0.25, 0.25, 0.25]  
# ---------------------------------------------------------------------------------  
def initialize(context):  
     schedule_function(trade, date_rules.month_start(), time_rules.market_open(minutes=65))  
def trade(context,data):  
    if get_open_orders(): return  
    for i in range(len(assets)):  
        if data.can_trade(assets[i]):  
            order_target_percent(assets[i], proportion[i])  
def before_trading_start(context,data):  
    record(leverage = context.account.leverage)  

You may look at Combining Strategic and Tactical Asset Allocation.

Thanks Vladimir,

I appreciate your code review.
Concise and accurate.

I like