GitHunt
JA

Jasone818/clustering-the-stock-market

Filtering the stockmarket into clusters with financial ratios built on quarterly snapshots over 5 years of data. The goal was to see the evolution paths of companies over time and find clusters that develop future winners. Methods used, PCA, UMAP, HDBSCAN, KMeans.

clustering-the-stock-market

Goal: Use 5 years of quarterly stock data across the Dow Jones to establish visual filters and informative clusters.

  • Doing so can highlight companies that are in growth phases, decline phases, or just kinda stagnant.
  • Using financial ratios combined with clustering, we can assess patterns between stocks in a convenient way.

Note that the model does not implement time series techniques as I wanted to achieve a generic overview of company characteristics. Here are some plots of the clusters.

A visualization of UMAP clustered by DBScan

This is a still of an animation that will follow stocks of interest over time through the UMAP shape.

Animation still - UMAP

Finally, here is a snippet of how the clusters are classified by feature in relation to one another. They are not alway strict boundaries, but there are some discernable themes.

What is the cluster made of?

Feel free to fork and play with the parameters, it is fun to watch the stocks move through the market over time in a more artistic way.

Languages

Jupyter Notebook100.0%

Contributors

GNU General Public License v3.0
Created February 12, 2021
Updated November 23, 2025
Jasone818/clustering-the-stock-market | GitHunt