All Weather Portfolio test result.
All Weather Portfolio test result.
A thread I started called "The Simplest Algoritm" contains an even simpler "algo" which contains 45% stocks, 45% bonds, and 10% cash at all times, rebalanced monthy. It performs about the same as this "algo"
As I said in that post, most hedge funds are charging 2/20 and most individual investors have the same portfolio, whethery they know it or not, whether through mutual funds or not. Hence, if you can improve over S&P 500 in terms of volatility and drawdown using one of these as "black box", as Ray Dalio already has, all you need to do is market that black box and gather assets. The sales pitch can be whatever you want it to be, and you can throw in some Dalio-like stuff like meditation, zen, karma, universal powers, nirvana, etc. which makes you sound like you know the meaning of life, when in fact all you know is 45/45/10.....or whatever similar sort of mix.
Here's a similar asset allocation I posted, but has a few tweaks:
https://www.quantopian.com/posts/all-seasons-strategy-from-tony-robbins-interview-with-ray-dalio
Behavioral Trader -
Yes, nothing new under the sun. Invoking John Bogle would seem more appropriate, in this case. Pre-ETFs, he was preaching doing the same thing with no-load, efficient Vanguard index funds.
For any active fund, including the one Quantopian is constructing, caveat emptor applies. Presumably, the kind of entities (HNW/family office, institutions, public funds, etc.) that Quantopian needs to court are not run by a bunch of knuckleheads; they know all about asset allocation strategies with ETFs. They'll be asking the same basic question as you have been asking - what will 2/20 get them? Where is the "alpha" coming from and how much should they pay for it?
"They'll be asking the same basic question as you have been asking - what will 2/20 get them? Where is the "alpha" coming from and how much should they pay for it? "
Grant, very true, but the thing is that when investors ask, Quantopian will not be able to say where alpha comes from, since by definition, they do not know the "algo" code. Even if they knew the algo code(s), they would still sell it as "multiple black boxes", sort of what Dalio and others have been selling while gathering billions in assets...no explanation, just smooth better than S&P500 returns...we all know where smoothing comes from (bonds and cash), so all you need to do is lever up a bit and you will reach the goal.
"the kind of entities (HNW/family office, institutions, public funds, etc.) that Quantopian needs to court are not run by a bunch of knuckleheads; they know all about asset allocation strategies with ETFs"
Smart people can be very dumb when investing and watching their money. They can make them, but rearely can they keep them. Just look at the "smart" investors who invested with Madoff...if you make everything black box, no one, no matter how smart will be able to tell what the ingredients are, and if Quantopian is smart, they will read this note, create a simple low expense asset rotation/allocation fund like the one we are discussing, and forget the other "fool's errand" attempts (and keep the other 10% for themselves).
Behavioral Trader -
It remains to be seen if Q will have an edge, or if it'll all turn out as you predict. I'd do a head-scratch on the Q's potential scale. There are over 3 billion internet users (http://www.internetlivestats.com/internet-users/), and every one of them (barring governmental and other artificial access restrictions) could try his/her hand at writing an algo. They only need 30 or so good algos to get the thing off the ground, I'd guess. I think they'll get there. Anyway, as I mentioned elsewhere, it'll be sexy, which will sell.
Grant, it does remain to be seen....Numerai is currently trying to sell the sexy thing, by making everything a total black box, even the stock tickers and the "features" i.e. predictive factors, so the algo developers don't know what they are using to predict unknown stocks. All they got is 1.5M in seed funding. Sex does not sell in the hedge fund world. Steady low volatility returns wrapped around 15% per annum rule that world. Just ask Madoff.
All very amusing and reflects my own views entirely. As an investor.
But here is another thought which I have not developed merely because I do not have the temperament or indeed the skills.
I believe long term forecasting is currently impossible and may remain so because of the laws of physics. Hence I stick to trend following and broad asset allocation in the hope I will catch what is out there without getting screwed by the Black Swan.
However, very short term forecasting may prove more possible. Look at the improvements in weather forecasting over the last 50 years. Your statistical techniques which I have so often derided may well prove more fruitful intraday, or even intra week. And if you can deal cheaply enough and can buy at the bid and sell at the offer (or at least not buy the offer and accept the bid) then perhaps regression analysis, pairs trading...pattern matching...whatever..is probabilistically possible (and profitable).
After all, there ARE very short term profitable traders out there. Toby Crabel and yes the HFTs. Unless ALL of HFT profit is front running? Surely not.
Unfortunately I am simply not qualified to venture an opinion. I have to recognise there are areas where I have absolutely no experience and nothing whatsoever to offer.
Anthony, I agree that varying time frames can sometimes prove to be profitable...a good example is Warren Bufett's time frame - approximately forever. You invest in the market and never take a loss, collect and/or reinvest dividends, and forget about it (i.e.sleep well)....Another good example you pointed out on the other side of the spectrum is the HFT front running by a few milli secods - always front run, make a fraction of a penny in rebates while not taking any risk, and you will have many years of trading millions of shares each day and not having a negative day, ever....
But 99.99% of the time, traders and investors trade some trime frame in between, where the real risk is, and so they underperform both Buffett and the HFTs. I am sure someone will be successful in "timing" these intervals, as that is a must given the number of people who are trying to time the market. Sadly, there is nothing to prove that if someone timed the market well in the past, he/she will time the market well in the future.
One notion which has made sense to me, but which carries its own risks is selling option premium, whether as a stand alone strategy or to enhance a broad asset allocation portfolio like we are discussing in this thread. We all know that option buyers pay too much, but if you are trying to rebalance each week or each month, you are better off rebalancing by writing options, than by selling or byuing stock outright. Too bad Quantopian has been mute on options.
selling option premium
Chum of mine does it and he sent me a track record of some firm he uses to give set-ups for deep out of the money option premium selling. I'll try and dig it out and post it. From memory, sadly, it was far from special in terms of vol and DD and no better than LTTF....so I lost interest.
I'm always on he lookout but that one did not look so promising.
They only need 30 or so good algos to get the thing off the ground
That's true but selecting 30 algos is not easy thing to do. IMHO 6 month contest (or even worse 1 onth ones they had before) selection they are currently running is very, very prone to survivorship bias when you have lots of competitors. I have trained genetic trading algos in the past trainng them is probalbly very close to running one of these competitions - the genetic algos try to curve fit like hell and play like they are not and it's extremely hard to know which ones really work and which ones don't. There are couple of tricks but I hope Q has thought this through as they don't like to answer my comments about this issue..
Here it is: they are called Quantum Leap Option Selling program.
OptionSellers.com
Nov 2008 to March 2016 as follows:
StdDev 24.81%
Down Dev 16.85%
CAGR 13.30%
Max DD -34.31%
Max DD length 42 months
MAR 0.387685815
They don't provide a track record on-line - these figures were mailed to my chum. I believe this is an un-leveraged version. Of course, other operators may perform better or worse than these guys.
But I don't find the program terribly inspiring.
@ Mikko -
I'm not sure survivorship bias is the right term, but the bias risk is more overfitting, except that the users are running the iterations over the parameter space, as you describe (rather than Quantopian writing the algo and overfitting it). In the limit of a very large number of diverse submissions, 30 of them will have decent backtests and look good out-of-sample for 6 months. The contest is guidance and flypaper, to attract algo writers. There is more due diligence that can be done, beyond the contest, including running longer backtests, using the pyfolio tear sheet for deep-dive analyses, asking for information about the strategy from its owner, etc.
My prediction is that if they survive, we'll see Quantopian morph in some fashion. They won't become a $10B AUM fund with their current approach, is my sense. I'd guess that this is an area of active discussion with their new hires, a Chief Investment Officer and a General Counsel and Chief Compliance Officer. Time to get real.
Anthony, these seem appropriate for deep OTM, but I am not certain what you mean by un-leveraged...the only way they can be unleveraged is if the selling is on the put side, so they are cash covered puts. Anything you do naked on the call side implies some sort of leverage....I suppose spreads on the call side would limit the risk and return.
As I mentioned above, using close to the money spreads is where the juice is...but that is going to be the black box I will ultimately try to sell ;)
Grant,
this is going a bit offtopic but IMHO survivorship bias is exactly the correct term
Survivorship bias, or survival bias, is the logical error of concentrating on the people or things that "survived" some process and inadvertently overlooking those that did not because of their lack of visibility. This can lead to false conclusions in several different ways.
My problem with contest is that if they really are serious about it the backtest period should be at l~10 years and include different types of market regimes. In fact some kind of n-fold would most certainly be better. At the current form the contest only rewards participants who have fitted their algo to the current market environment and there is no regime change.
If you pick the top N algos from the contest you basically have tested the algo with 2 in-sample periods - it's harder to curve fit for forward testing data but if you calculate fitness score for the period and then select algos based on that it's still in-sample. I'm not sure if Q understands this. If the in-sample period (including backtest) is long enough and fitness score robust enough (again I'm not sure if the current scoring system is but I can't be sure as I have not ran any real test with the score - it would be quite easy to test with genetic algo framework and real out-sample data for selected algos) it will tell something but current 2.5 years is nothing and contains only uptrending market. I wouldn't invest in fund that has selected their algos based on this but I'm of course not sure what the actual selection process is. I truly hope it contains longer term backtests.
Guys, the underlying issue is not overfitting or survivorship bias. We all know that everyone will overfit their code in-sample, HOPING that it will perform similarly out of sample. Also, Quantopian will look at algos with a less than 10% drawdown and other criteria (see below), so by definition, there is going to be survivorship bias.
The main issue is Quantopian is myopic (no offense, trying got be constructive) in setting their criteria. You can NOT have low beta, high alpha, high sharpe, low vol, relatively high return algos - this is a fool's errand, search for the Holy Grail, etc. You must sacrifice some of their criteria to be successfull in the hedge fund world, but in looking for perfection they have set unrealistic criteria thereby promoting overfitting and consequently survivorship bias.
I hope they win some investor money but I really doubt it, since those investing will know that the criteria are unrealistic and that the true risk is understated.
Adding options backtesting can be how Quantopian can make money even if they do not win any investor money. I have not been able to find a good backtesting environment for options trading, and we all know that options are the bread and butter of hedge funds. Sticking to futures and or equities is very last Century...as a matter of fact, I personally would pay a premium for a Quantopian membership which has backtesting capabilities on options, at least on the S&P500 stocks.
Out of interest Behavioural Trader, what sort of risk return metrics are you expecting over the longer term for an ATM option writing strategy?
Needless to say, I agree wholeheartedly that's Q's criteria is unrealistic.
Re options I assume it would not be too difficult at all to backtest in Python given the appropriate data. I have now spent a year on Python and can see it's power and flexibility. Not using Zipline - but adapting another open source backtester.
Anthony, it depends, but I am working on/testing a very agressive strategy, sort of a utopian one, 2^10, if you will (If you have read read "Fortune's Formula" you would get the reference). Otherwise, my tests of selling ATM options seem promising but I am unable to quantify them and test them on many underlyings.
The main issue is Quantopian is myopic (no offense, trying got be constructive) in setting their criteria. You can NOT have low beta, high alpha, high sharpe, low vol, relatively high return algos - this is a fool's errand, search for the Holy Grail, etc. You must sacrifice some of their criteria to be successfull in the hedge fund world, but in looking for perfection they have set unrealistic criteria thereby promoting overfitting and consequently survivorship bias.
To be honest I personally don't understand the beta requirement at all if they are planning to create a fund based on N combined algos. If you combine algos with opposite betas and they have high alphas you will get the values you want from weighting the algos. Opposite betas combined will result in low beta if the algos are mostly in market. The same thing for other values like drawdown. Combine two methods with opposite up/down periods but still high alpha and you will have smoother line up. Then it's just some monte carlo and you have some understanding of your risk levels to certain extent. Trying to aim low beta for individual algos means the algos will have some kind of duplicate beta hedging going on and isolating the real alpha or combining them wisely will be much harder even more so as the logic for Q is at least to some extent a black box.
It is even more problematic that beta is calculated with rolling 1 year mean as market regimes usually last over 1 year. If you want to have decent profit trading stocks in uptrend you are going to have higher beta and if you try to make profit in downtrend mostly trading stocks you will have negative beta. This doesn't mean you don't have average long term beta of almost zero but at the down/uptrends you will have high/low beta unless you are trading equities with low correlation to SPY. And at dynamic systems that rebalance based on their view 1 year beta doesn't tell about the risk, drawdown does.
Beta is important for static investing like index funds for example but shorter term beta IMHO does not tell that much about market risk for algos that rebalance dynamically.
just my 2 cents.
ps. my experience says that it's better to combine as many as possible uncorrelated algos that might individually have poor stats but higher alpha than to try to create single "super" algos. The result will almost always be better from a with as large set as possible as long as the algos are uncorrelated and there is clear alpha. This is easy to test with monte carlo and some random curves if someone wants to prove this.
@ Mikko -
they are planning to create a fund based on N combined algos
To get to this point, N has to be a fairly large number (e.g. 30) to be even close to the realm of large-number statistics. At this point, Q just needs to get the thing off the ground, without it exploding (and without exhausting their funding and not being able to get more). Hence, each algo needs to have (1+r)^n returns, like a bank CD. The other issue is that if they accept unhedged strategies, then they'll just get a bunch of long-only (short-only) algos during bull (bear) markets. This is what happened when they kicked off the contest (which I won with an intentionally over-fit, long-only algo, which then went bust--$10K lesson learned). And how do the incentives work out? It is simpler, at this point, to just say "Write an algo that looks like a bank CD, except with 10X higher return and we'll share the return with you." Otherwise, there has to be some overall profit sharing, but it is a chicken and egg problem at this point--no profits, no sharing.
You do raise a good point regarding the low beta requirement potentially driving hedging to an unproductive extreme. For example, I have an algo that uses a broad market ETF to keep beta close to zero, at every instant in time. If others are doing something similar, the Quantopian fund will have lots of individual strategies, each trying to keep beta down to zero, with positions in ETFs, when it might make more sense to drive down the overall beta by combining higher beta algos without ETFs in them, and then, in the end, applying an overall efficient market hedge, to bring beta to zero (if, in fact, that is the goal).
One gripe I have is that the requirement of "Low Correlation to Peers" (see https://www.quantopian.com/fund) is not a good requirement. How am I to measure it? And if I could, what are the limits? The contest can be used to provide some measure of feedback, but my concern there is that the pool is highly contaminated with overfit, unrealistic backtests (see https://www.quantopian.com/posts/q-paper-all-that-glitters-is-not-gold-comparing-backtest-and-out-of-sample-performance-on-a-large-cohort-of-trading-algorithms). And a 6 month out-of-sample period is too long to wait, and too short of a time frame. So, what am I to do with the "Low Correlation to Peers" requirement? In developing an algo, how can I know if I'm heading toward the goal line vis-a-vis its correlation to peers.
The other gripe is that Q hasn't actually published the legal relationship a "manager" would be forming with them. They are asking the crowd to do a lot of work, without actually revealing specifically what they'll expect in the end. Not cool. But then maybe they don't know how things will play out, as they try to get outside money and comply with regulations, so they are keeping the details confidential?
Personally I view what Q provides here and via pyfolio and Zipline a huge give away.
If I could be bothered with the vast complexity and ever changing nature of Zipline I would end up with a superb tool.
In return for these huge gifts as well as this online testing forum, Q is really getting nothing whatsoever in return at the moment.
So in my view it is we who are getting the better side of the bargain.
I can't be bothered with the competition and certainly have no intention of coming up with an Unicorn trading program ( because they don't exist).
But I admire these guys for what they have produced and wish them well.
By hook or by crook they deserve to succeed. Personally I get bored of giving away research and ideas for zero return and hope these guys manage to get some payback.
"So in my view it is we who are getting the better side of the bargain."
For sure!
I am not even good at programming, but I would certainly pay a permium membership fee if they add options....There are multiple ETF/Stock backtesting platforms, but options are missing from the marketplace at this time, and Quantopian would fill a great demand. Just my 2 cents on this. Always rooting for the good guys, but along the same lines, we need to offer some productive criticism and feeback when things go TOO utopian...not that utopian is bad - that is where they got the second part of their name, I suspect.
Chortle, at least its not Dystopian.
BTW I was looking at AQRs retail funds over the past couple of days. No magic there, that's for sure. Same with Bridgewater's recent perfomance.
I must get hold of long term track records for each firm - a bit of schadenfreude is always good for a laugh.
Back on topic:
Simple All Weather Portfolio by Ray Dalio
I have been looking at stock market and bond market prices / indices going back to the 1850s. Of course the future wont resemble the past in any faithful way, nonetheless its useful to see what would have happened to an all weather portfolio over the period.
I am running tests simply switching between the stock index and bonds for the entire period for England and the US. Nice to have a VERY long period of bond BEAR market to test on.
Amusingly, I finished my little all weather experiment with DJIA monthly prices going back to 1900 . No dividend data unfortunately although I did a separate experiment with Schiller's S&P data (which includes dividends) which did not make such a huge difference.
Using a 12 month look back:
1) switch between the DJIA and the US 10 year bond.
2) switch from pure US 10 year to 1/2 and 1/2.
Results for 1: CAGR 7.89%, vol (annualised monthly) 10.76%, Max DD 37%
Results for 2: CAGR 7%, vol 6.08%, Max DD 19.19.
I will probably do the same experiment with such UK deep history data as is available.
Who needs hedge funds? Option 2 looks rather satisfactory.
The switch is done on momentum. Switch to the instrument with the greater 12 month return. On a .monthly basis.
What if you'd applied 6X leverage starting in 1900? Probably end up owning the solar system... It does sorta make one wonder.
Anthony, nice, very nice.
Now all you need is some marketing guys, or better yet, just say your brand new black box quant fund is sold out and closed for new money (after one day of marketing). They should come knocking on your door, begging to get in on the next round.
I know this thread is a bit old, but I have a question regarding this code, as well as a general beginner question about the code (just started learning Python!).
Is there a way to create a portfolio of stocks that fills the stock position instead of 'SPY'? I've made my list of stocks by doing the following, ```
def initialize(context):
context.portfolio.positions[symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x')]
```
All of that is nice and good, but then I run into an error down around line 51 that says "UnsupportedOrderParameters: Passing non-Asset argument to 'order()' is not supported. Use 'sid()' or 'symbol()' methods to look up an Asset."
That code on line 51 looks like this:
``` if not context.fired: order_target_percent(context.portfolio.positions, context.portfolio_positions)
I know this is a long drawn out question, but I feel like the answer is simple, I just can't figure it out!
Thanks in advance! Love this community!
Brandon,
I'm not sure if it's a typo or intentional but order_target_percent() takes two arguments minimum, the first is the stock (singular) that you want to order and the second argument is the percent you want to target, such as .2 for 20%. the easiest way to do it is in a loop like this:
if not context.fired:
weight = 1.0/len(context.portfolio.positions)
for stock in context.portfolio.positions:
order_target_percent(stock, weight)
Thank you! I added that and then I got this error message:
ZeroDivisionError: float division by zero
So then I just deleted the weight = ... section and it started to run, however, when it got to the end of the year, it gave this error message when it came to rebalance:
UnsupportedOrderParameters: Passing non-Asset argument to 'order()' is not supported. Use 'sid()' or 'symbol()' methods to look up an Asset.
I'm not sure how to fix this either.
Sorry for all the questions! You're being such a great helper!
You attempted to divide by the length of an empty list. Sorry I didn't notice it before but you have to declare your list of securities like this in the initialize() function: (you are missing the equal sign)
context.portfolio.positions = [symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x'), symbol('x')]
The 2nd error you keep getting is because you attempted to order without the right arguments. Every order_target_percent() needs to have a stock and a weight, not optional. You should probably go to codecademy.com and run through their basic python lesson first just to get a handle on how to use variables and functions before you attempt to modify or create an algorithm.