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
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
Thanks @Fred, this is a particularly interesting algo to share. Your t-shirt is on its way!
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.
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.
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 :).
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
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.