Use scikit-learn PCA to measure how much your stocks move together.

By PyQuant News

Published: 2026-10-24

URL: https://pyquantnews.substack.com/p/build-your-own-market-analytics-app


Each week, I send out one Python tutorial to help you get started with algorithmic trading, market data analysis, and quant finance. Upgrade to a paid plan to access the Python code notebooks, Discord community, and code support.

Subscribe now


If you’re going to rerun the same analysis more than once, an analytics app is a great way to do it.

People in my course ask whether a web app means learning JavaScript and fancy web frameworks first.

The answer is no.

Stuck in the notebook

When I measured which shared movements drove returns for a basket of bank stocks, the tickers were hard-coded in the first notebook cell. Swapping JPM for GS meant re-running every cell and comparing a fresh bar chart to the one already scrolled off screen.

Students in my course do the same thing. They retype the start date, re-run, then lose track of which run made the chart on screen.

When I ran quant risk development, we handed traders a screen so they could change inputs without editing code.

What you’ll build

In today’s post, you’ll build a Dash app that takes the tickers and dates you type in, calculates daily returns, and charts how much variation each component explains.

Let’s go.