Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
shortless market neutral

I'm not sure how this thing works, but it seems interesting in that it is a shortless market neutral with a relatively high SR.

9 responses

Grant,

I am not very good at reading code.

Did you come up with this yourself?.

I think this is just another algo that is highly overfit.

The returns on XIV, SPY, and TLT have all been phenomal since 2011.

However, unless rates go negative, you wont see treasuries perform this well in the future, which I think is what brings the beta to near zero.

Grant ,

I was always wondering: why do you using minute data for weekly trading?
Here is a version of yours "Shortless Market Neutral" algo with another trio and daily data, backtested from June 2007 on $1,000,000 initial capital .

Again, this is highly fit to data.

Its never good when you are manual selecting etfs to trade.

Maybe try adding https://www.quantopian.com/posts/pnl-profit-and-loss-per-stock to each of those, it's easy, just paste at the end of initialize.
They both have a time where TLT suffers losses with a lengthy downturn leading to under water so if you can figure out a way to see that coming and avert it without harming the profitable periods, would make more.

My own attempts in that have not had impressive results, could be something I'm missing. For example I would maybe do this:
Near a point where TLT PnL drops below zero (maybe even -1000), take a look at its slope for ~5 days and if that is significantly negative, close it out and wait to buy again until the slope of SPY is down (since the two are somewhat inverse relative to each other).

Gary,

Thank you for PnL - Profit and Loss per stock code.

@ Miles -

Did you come up with this yourself?

Sort of. Over time, I tend to grab bits and pieces from the Quantopian form and cobble them together. I think the ETFs came from someone else's post; I did not research them myself. I cooked up the idea of minimizing the variance with constraints (although I probably came across the general concept in a paper). The weighting by standard deviation is a concept mentioned on Quantopian and in a book I read.

I think this is just another algo that is highly overfit.

Possible. I don't claim to understand it. One thought, though, is that XIV, SPY, and TLT are all broad index-based ETFs, so that's a plus. You are suggesting that there is an underlying risk, so what is it? And how can it be managed/hedged? One advantage of Quantopian is that potentially bad algos can be exposed and discarded, or fixed, so that they are no longer bad.

@ Vladimir -

I was always wondering: why do you using minute data for weekly trading?

For short look-back periods (e.g. 5 days), there is very little data. Also, closing prices come from a single trade at the end of the day; intuitively, why not use more data in some fashion? There's a lot more flexibility in using minute bars, since smoothing can be applied. If there are too many data points, then the data can be decimated.

I am not exactly sure how TLT works. But my guess is that the bond duration is atleast 20 on a rolling basis.

That means a 1% change in rates corresponds to 20% price move.

From 1980 to now, rates have gone from 15% down to 2%. (TLT returns fanastic)

From 1940 to 1980, rates went from 2% to 15%. (TLT returns would have been terrible).

So I would say the underlying risk is interest rate risk. It is pretty reasonable to assume that rates wont go negative which puts a cap on price appreciation at this point in time going forward. However, makes it look great in the past.

The 2.8% percent yield you are getting doesnt really justify the risk long term, which Buffet pointed out and I agree with (look at the fed model).

However, if there is good enough volatility in rates, one should be able to continuously buy low sell high.

@ Miles -

What's interesting, though, is that the idea of an eventual rate hike has been kicking around for a long time. So one has to wonder if it is somehow already baked in? In other words, if rates have no where to go but up, then wouldn't the market already have backed off from investing in TLT, for example? Maybe everyone is already listening to Warren Buffet?

I would think so too.

However you have:

Huge international demand for yield because the rest of the world looks like shit right now
A strong dollar
Baby boomers retiring by the millions and looking to shift their risk
A huge government debt where if yields got too high US would be screwed
No signs of uncontrollable inflation

If I could tell you right or wrong, Id be invite you to my private island to share the idea

The concept however of basically collecting an insurance premium and taking the profits into treasuries is one that works very well and one that I partake in however,when you look at data over long periods of time, it says its not the greatest idea given interest rate risk.