Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Mean Reversion with a Variance Threshold

I was wondering if anyone would be brave enough to try and code the following algorithm from the paper.

http://jmlr.csail.mit.edu/proceedings/papers/v28/cuturi13.pdf

I have emailed the author and he has sent me the matlab code but I am in over my head :).

I can forward it to someone if there keen to try.

Best Regards,
Andrew

14 responses

Please send the code to peter.f.a.bakker at gmail dot com then I'll try ....

Here are the results on 6 months. still needs some polishing but looks promising.

Well, I thought I should share some interesting results on this topic. I implemented portmanteau statistic minimization algorithm mentioned in this research paper using zipline on daily data for 25 energy stocks. I fit it on 300 days and tested it on 10 days out of sample.

You can see the plot of stationary and mean reverting series here

The basket is 100K of 25 energy stocks and the long term mean of the stationary portfolio is around 6600$ with a standard deviation of 160$. So basically while the algorithm results in nice stationary series they are too stationary to be profitable with transaction costs.

Wow Satyapravin that looks awesome!!.
I was wondering if the code was available for experimentation :).
Looks like a fantastic piece of work!

Andrew, I just ported the matlab code you gave me. I will send you python code over email. I don't want to share it on community forum.

Many thanks Satyapravin!
Really appreciate it :)!!
You should enter the competition with your skills :)!!

Yeah that looks great, too bad the variance was not higher!

Couldn't you just increase the minimum variance constraint of the portmanteau optimization?

I tried but CVXPY failed to find a solution.

You might have some luck throwing a bunch of ETFs into this and seeing what it comes up with, and it might work better if you give it fewer to work with. Regrettably many of these baskets are mean-reverting only without taking into account the bid-ask spread, as I have written about elsewhere, but the portmanteau stat in his paper looks promising.

@Pravin Bezwada I am trying to get the above up and running but does not seem to work any more, perhaps due to the updating to Q 2.0. Wondering what changes need to be done?

@Suminda

I will take a look over the weekend.

By the way, the code can be a lot cleaner now that quantopian supports CVXPY.

OK.

BTW, Is there a way I can contact you. I have been actually trying out some your other algos also.