Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Fundamental data KMeans clustering

This is an algorithm that clusters stocks based on a set of fundamentals (I have used Max's set of 4 fundamental ratios as a basis). The algo clusters the stock universe around fundamental data. It then tries (and this is where this needs improving) to rank the clusters and take long-short positions on top and bottom clusters. The ranking for now is done on past performance, which is somewhat naive. I am calling on Q's best and brightest to suggest improvement on rank the clusters. Or maybe this is just a dead end.

Some of the code for cluster manipulation comes from a post from Jonathan Larkin.

/Luc

2 responses

Hi Luc,

Grant Kielhne has contributed an algo for alpha combination using spectral clustering that follows a pipeline format and conforms to contest specs. Here's the link: alpha-combination-via-clustering You can substitute your choice of clustering routine. Hope this helps.

Thanks James for this. I looked it up and it is quite an impressive piece of code. I have yet to understand the clustering bit, as it clusters 20 factors (samples), each having 5*1715 features. I will look further into it... But really, Grant did a fantastic job.

Mine does not work the same way, as it clusters stocks and not factors. Mine clusters 1500 stocks around 4 factors, creating clusters of stocks with similar factors.

/Luc