Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Best performing algorithms

Hi all,

I am new to Quantopian and deciding whether I invest my time alot further. I had some questions which maybe the community could help with?

  1. The most successful algo, what type of margin would they expect 10% per annum? Obviously this depends on whether we are in the bull or bear market how would they then to perform vs the market?
  2. How long does it take to get something "ready" that is profitable. What do you think the minimum would be?
  3. I saw some numbers that Grant K posted but I guess it differ if you have privately backed fund with £1m+

Thanks in advance!

Cheers,

Chee.

47 responses

First off, welcome!

As you probably already guessed, there's no single absolute answer to "whether I invest my time a lot further". My view is that the single biggest factor playing into a decision whether to take the leap into Quantopian (or algorithmic trading in general) is if you enjoy it. Do you enjoy coding, creating algorithms, analyzing problems, researching and developing ideas, going where no man has has gone before (and so on)? If software and finance aren't something you already do and enjoy doing and have an aptitude for, then you may find the learning curve vs the rewards is too high and will probably loose interest fairly quickly. I'd speculate (but would really like to know if Q would share) that the 'turnover' on Quantopian is very high. Of the 100,000 purported users only 1000 or so stick to it for more than 6 months. Of those, maybe half participate in the contests and/or live trade their algorithms. I'd venture the main driver for those individuals is a Sheldon-esque passion for the process (though maybe I'm just speaking for myself).

The second biggest factor that plays into "whether I invest my time a lot further" however, is one's capital base. How much money do you have available to invest? If you have $5000 and really enjoy it, then by all means, jump in! You probably won't get rich but you'll have fun and maybe make a bit of profit along the way. If you DON'T really enjoy it, then go do something you love. One won't succeed where there isn't passion.

However, if we're talking $500,000+ and one is expecting to live off their investments at some point, then the calculus changes a bit. It's my opinion that there are only three reasonable approaches to investing. 1 passive investing (buy a stock and a bond ETF and rebalance quarterly or something similarly passive), 2 actively managed investing (hire a money manager to more actively manage your funds but just make sure they are netting you more than the market with less volatility and their name isn't 'Bernie'), or 3 algorithmic trading. If you have the capital and are expecting to earn a large portion of your income from that capital, then it may make sense to explore option number 3 if one is at all inclined towards programming and finances.

So, with that in mind, here's my answers...

  1. The most successful algo, what type of margin would they expect 10% per annum? Obviously this depends on whether we are in the bull or bear market how would they then to perform vs the market?
    I read your question as "what is a reasonable expectation for annual return? Is 10% reasonable?" and "how do algorithms perform vs the 'market'?". What's missing in the question is volatility and drawdown and how long that drawdown lasts. Without ones expectations for volatility, then returns are meaningless. If one is willing to put up with a 50% drawdown for a year (ie start with $100,000 and see it drop down to $50,000 and not be back to breakeven for a year) then you could get a 50% average annual return. (Simply invest in XIV). However, most mortals don't have the stomach for that and would have thrown in the towel after a couple months of losses. So, I'll posit a more palatable drawdown of 12%. That's less than the volatility and drawdown of the S&P500 over the past 5 years. I'd say one should expect to do about 50% better than the market (ie SPY). Over the past 5-7 years the market has averaged about 12%. A reasonable algorithm should return about 18%. Attached is a VERY simple algorithm which hits these targets in a bull market like we've had lately. Containing the downside risk when the market isn't doing so well is the challenge however. Here is a link to a contest winning algorithm https://www.quantopian.com/posts/contest-8-winner-robert-shanks. Look at the notebook in the post which shows an annual average return of 16% and volatility of 11%. That might be a good benchmark.

  2. How long does it take to get something "ready" that is profitable. What do you think the minimum would be?
    My advice is to start trading as soon as possible with a simple algorithm (maybe similar to the one attached) to get the 'feel' of trading. Then incrementally make improvements. First focus on reducing the volatility, max drawdown, and drawdown time. Then focus on increasing returns. Look through these forums for ideas and help. You will find that returns are often the easy part (just add a little XIV or leverage to any strategy :) ). If you have a bit of aptitude and spend a few hours a couple times a week, my guess is that you'll feel comfortable with the tools and have made some solid headway in 6 months.

Good luck.

ps: I can post a 'Robinhood friendly' version of this algorithm which you could use out of the box. No guarantees but I have traded with it. Let me know.

Hey Dan,

Firstly thank you for taking the time to write some a detailed post. It is very much appreciated.

So I have always had an interest in share trading and I work with data more from an analytical perspective rather than coding (although I have coded some moons ago). My work in the industry I am in (digital marketing) is about to end and looking to investigate new opportunities and how to invest money in different ways. The plan is actually a combination of things:
1. Lower risk options (property, managed funds)
2. Hedge fund opportunities / algo trading

One area that interests me is combining regression tested quantitative data with additional qualitative data for extra signals vs what pure algo trade would provide. I am trying to understand what platforms are best. Q seems to have alot of the architecture you would need so would be really a kick start for algo trading part. I am also have investors who would be interested in investing in other peoples algos which would make this platform interesting.

The ROI actually seems reasonable, although I assume the risks are slightly elevated depends on how the drawdown is managed.

One other question I had was a lot of the posts I have seen with forecasts tend to show performance against a bull market. Do others compare performance in bear or flat markets and achieve positive ROI through short selling?

Thanks,

Chee.

Some thoughts on the questions above...

One other question I had was a lot of the posts I have seen with forecasts tend to show performance against a bull market.
I'm guessing you are referring to the posted backtests and the fact that they may typically only go back 5-7 years. You are correct that one should probably backtest over a longer period and ideally through the 2007-2010 downturn to get a better idea of performance.

Don't just look at the raw backtest results though. Quantopian provides a nice tool called 'Alphalens' to slice and dice the results and show performance during various bull and bear time periods. See https://www.quantopian.com/posts/alphalens-a-new-tool-for-analyzing-alpha-factors

Do others ... achieve positive ROI through short selling?
Short selling is certainly one very solid strategy for weathering a bear market. Swinging in and out of bond funds or inverse ETFs can also work.

How long does it take to get something "ready" that is profitable. What do you think the minimum would be?

It depends on what that "something" is, but generally, I think 6-12 months of out-of-sample backtesting/paper trading, followed by perhaps 6-12 months of real-money trading, to actually know if the thing works. If you are wanting to attract outside capital, you probably need 2-3 years of real-money trading at a relevant scale (this, I believe, is why Quantopian needs Point72 and their $250M seed-money commitment--otherwise, they might never get off the ground and reach the $10B level).

My sense is that Quantopian is solely about the hedge fund, so if you are interested in just jumping in and learning, and having the greatest overlap with their training and support, see:

https://www.quantopian.com/allocation
https://blog.quantopian.com/a-professional-quant-equity-workflow/

It may be a long-shot, but if you are just wanting to get into the field, trying to write algos for them, versus for yourself, might be the best way to go. If you have something that looks pretty good, you can contact them, and they might give you some feedback. Or you can post a pyfolio tearsheet to the forum, without revealing the code. Personally, for a variety of reasons, I don't trade my own money; I just fiddle around trying to learn, as a hobby, and get on Quantopian's nerves from time-to-time with my opinions and off-topic meanderings.

Interesting discussion here. I would also challenge the assumption "Obviously this depends on whether we are in the bull or bear market . . . ."

Here at Quantopian, we are looking for algorithms that are indifferent to the market's movements. We are looking for low-beta algorithms with a moderate risk-adjusted return. The algorithms we are making allocations to are ones that find success in both bull and bear markets.

Note that I'm not saying that there is only one "right" way to invest - but there is only one way to get an allocation from us.

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.

@ Dan D. -

It would be interesting to see some data detailing the extent to which the algos you've funded and have in the evaluation queue conform to:

https://www.quantopian.com/allocation
https://blog.quantopian.com/a-professional-quant-equity-workflow/

I'm particularly curious if there has been any tangible success in users writing the kind of multi-factor, cross-sectional, giant, swirling, super-duper strategies that Jonathan describes, or if you see more single-factor type algos. My original understanding of the Q fund was that you'd be combining lots of single- or few-factor type algos (and perhaps this was the original concept), but we've landed on your needing self-contained scalable, institutional-grade algos from individual users, implementing perhaps 5-10 factors, combined with ML and then run through the optimizer API--a bit daunting, in my opinion, for non-professionals. I get the impression that it is the sort of thing that, within a traditional hedge fund, would not fall on one individual, but a team (but maybe I'm mistaken here--perhaps it is common for individual coders/traders/managers to write and deploy soup-to-nuts strategies at tens of millions in capital single-handedly). And in some respects, you've introduced external competition, by offering signals, such as https://www.quantopian.com/posts/alpha-vertex-precog-dataset . It feels like a pretty high bar.

Dan Whitnable,
I definitely fall into the watching and asking category........
If you don't mind I would like to have the RH friendly code. The code above is simple enough for me to conceptualize, tinker with, and implement if warranted. I work on a couple of asset allocation models on thinkscript but don't see a real future with their integration on that platform.
Thanks and happy trading.

@Hunt

Here's the Robinhood friendly code for above. Basically it places the sells before the buys so there is money available to buy (Robinhood requires you have enough available cash on hand). It also controls cash better by placing limit orders for specific quantities of shares rather than relying on market orders or the built in 'order_target_percent' method.

One note of caution. A big reason why this algo does well in the backtest is that both bonds and stocks did well from 2011-2016.

If you want an indication how it did during 2007-08 you can take a look at this backtest. I swapped to equivalent non-leveraged ETF's (to get a longer history) and leveraged them 3x to simulate the performance of the original algorithm. You can see it takes >50% drawdown. (drawdown is worse with 3x ETF's than with 1x ETF's leveraged 3x by the way)

Here is "My all weather trio" very similar to Dan's diversified portfolio.
It does not need to be leveraged 3x or rebalanced daily, unless you want that.

@Vladimir great algo! Super simple and effective

@Vladimir How did you get the exact weights, could it be overfitted?

@Vladimir I used your All Weather Trio to make some modifications with rebalancing at the end of every month.
Returns are not really good, but the max drawdown was divided by 2 (10%).
I'd love to have your feedback.

ps: sorry for the code, I've just started to learn Python

Hi @Vladimir,

Thanks for sharing, very interesting one. What's the economic rational of shorting against Europe Developed, UK & Japan?

@Vladimir, thanks for the advice!

Here is performance tearsheet of "Volatility adaptive all weather trio".

Hi @Vladimir,

Thanks a lot for your explanation. Now I understand it and makes totally sense. It was very useful.

Hi @Marc, please help me understand how does shorting 'EFA' make sense.

Hi @Ritam,

As @Vladimir explained this is a dollar neutral all weather portfolio but instead of shorting 50% of the portfolio, you buy bonds and just short a 15 - 20% of the portfolio. The reason to short is just to hedge and protect against market falls and as the allocation is not that big, it doesn't have that much impact which index you short (as long as you don't short something that contains most of the stocks of Nasdaq 100 in this case).

With that in mind, I guess that the more negative correlation or no correlation of Nasdaq 100 and the index you short, the better (@Vladimir might confirm that).

Variance of @Vladimir algo with the leveraged ETFs to seek higher return (comes with higher drawdown).
Full credit to work : https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3549581

Hi @Vadim,

What's the point of using 20Y US Treasury levered 3x (TMF) and unlevered (TLT)?

@Marc,

I followed the paper
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3549581
Probably would be worth to check if unlevered TLT is really needed.

@Vadim,
If you accept Max Drawdown -30%, this setup is more favorable than discribed in the paper

ASSETS = {symbol('TQQQ'): 0.50, symbol('TMF'): 0.35, symbol('EDZ'): 0.15}; LEV = 1.0;  

Total Returns
1757.83%
Benchmark Returns
225.39%
Alpha
0.25
Beta
0.43
Sharpe
1.48
Sortino
2.14
Volatility
0.21
Max Drawdown
-29.87%

But for myself I would prefer this setup:

ASSETS = {symbol('TQQQ'): 0.35, symbol('TMF'): 0.25, symbol('EDZ'): 0.10, symbol('IEF'): 0.30}; LEV = 1.00;  

Total Returns
858.8%
Benchmark Returns
225.39%
Alpha
0.20
Beta
0.26
Sharpe
1.51
Sortino
2.19
Volatility
0.15
Max Drawdown
-22.15%

Or this:

ASSETS = {symbol('TQQQ'):0.40, symbol('TMF'):0.30, symbol('EDZ'):0.20, symbol('IEF'):0.10}; LEV = 1.00;  

Total Returns
902.43%
Benchmark Returns
225.39%
Alpha
0.24
Beta
0.02
Sharpe
1.37
Sortino
1.99
Volatility
0.18
Max Drawdown
-19.87%

Here is performance tear-sheet for
Robust Leveraged ETF Portfolios modified.

Hi @Vladimir,

In your setups your are not adjusting weights with inverse volatility and you are not hedging with a short right?

Thanks

@Marc,

In your setups your are not adjusting weights with inverse volatility and you are not hedging with a short right?

In all 3 setups above the weights are not adjusted by inverse volatility but I will try to do that later.
I am sure the returns will be higher and max drawdown smaller.

I hedge 3x TQQQ by long position in -3x EDZ (Direxion Daily MSCI Emerging Markets Bear 3X Shares)
which will allow to use the strategy in retirement accounts.

For Robust Leveraged ETF Portfolio, Volatility adaptive I used just 3 symbols(Trio).

ASSETS = symbols('TQQQ','TMF', 'EDZ');  

Here is performance tear-sheet for my Robust Leveraged ETF Portfolio, Volatility adaptive.

Hi @Vladimir,

Thanks for sharing. Do you look back 1 month to compute the inverse volatility to re-weight?

Thanks

ASSETS = symbols('TQQQ','TMF', 'EDZ');
But applied a mild leverage in average 1.25

Hi @Vadim,

At some point you are long 92.19% TQQQ. Apart from leverage, are you adjusting weights on inverse volatility here?

@Marc,

Yes, I apply adjusting weights on inverse volatility based on your algorithm.

@Vadim,

But applied a mild leverage in average 1.25

What is the reason?

If you would apply mild leverage 1.5 the results will be even better.

Total Returns
5697.78%
Benchmark Returns
206.77%
Alpha
0.42
Beta
0.21
Sharpe
1.48
Sortino
2.15
Volatility
0.30
Max Drawdown
-28.67%

To compare different algorithms, they should have the same leverage = 1.0

hi @vadim,

using std**2 would be better as the expected return by kelly criterion ;)

Hi @Louis,

Actually std**2 accelerates returns, but also drawdown increased

Further improvement.

TQQQ allocation is adjusted by recent highs
thats
raw_wt_qqq proportional to ((recent_high_qqq/current_qqq))/(R_qqq.std()**2)

Hi @Vadim

I believe your idea is more base on a mean reversion in

raw_wt_qqq proportional to ((recent_high_qqq/current_qqq))/(R_qqq.std()**2)

Then you can slightly increase the return but also drawback and volatility by reducing the hedge in bull market

raw_wt_edz = 0.15*(recent_low_edz/current_edz)/(R_edz.std()**2)

I saw your tearsheet result, but when i ran same idea, I had more drawback and less return, would you mind to share your code to lemme do some more contrast comparison?

Hi @Louis,

Sure. Here it is, it is a little dirty right now as I continue to hack it

Hi @Louis,

I see that using variance instead of standard deviation speeds up returns and at the same time it increases drawdown but, how do you noticed it improved the Kelly Formula? (P*W-L)/P

hi @Marc

Actually i uses the stock version

(drift - r)/std**2

the above test has a typo, so i deleted it, now corrected with actually increased return by mean variance and increase hedge at bottom of market

i tried trend follow version by change max/current of tqqq to current/max but not as good

any ideas on drawdown control?

Hi @Louis,

Here is my variation of your version:

The next tuning

Hi there,

very nice paper, and even better symbol pick and discussion ;).

One quick suggestion so weights add up to 100%:

        #order_target_percent(tick, weigh/total_wt)  
        order_target_percent(tick, wt[tick]/total_wt)  

But more important: what else would we need to trade it live? E.g.
- Schedule on a daily basis to catch fast market movements
- Round the order target percent (e.g. 5%, 10%, ...) to reduce slippage and commission
- For each bull, bond and bear symbol, add a second symbol to broaden the basis even more

Hello everyone,

This discussion is really awesome. @Vadim I was wondering what you tweaked in your "next tuning". It's an interesting change considering the sharpe ratio dropped some but you increased returns with roughly the same amount of drawdown. If you wouldn't mind sharing the edit you made that would be awesome!

@Austin,

Here is the code. I would like to hear a feedback on how to improve

This algorithm works very well in the last 10 years.
But what if US market enters a 2-3 years bear market and not rally in the next 10 years?

Have you consider other trading vehicle etfs ? Will you still pick edz ?
Have you consider adding ugld into portfolio?

If I add ugld and allocate like this: tqqq-45%, tmf-25%, edz 15%, ugld 15%,
how do I change the program?

thanks

Vladimir added some comments here enter link description here, which may be of interest to the "My all weather trio" strategy. Among other things, the sensitivity of the choice of ETFs and the frequency of rebalancing.