Use pandas and TA-Lib to score volatility against future returns.
By PyQuant News
Published: 2026-08-29
URL: https://pyquantnews.substack.com/p/how-hedge-funds-engineer-factors
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.
Most trading ideas can be reduced to a single number you can test.
Beginners assume the model does the work, so they feed raw prices in and wait. The pattern almost never shows up that way. What matters is the number you calculate before the model ever sees it.
You can spend months adjusting model settings when the input you started with never predicted anything.
Ten minutes of checks
When I built analytics for a metals trader, I tested a volatility measure (how much a price swings up and down) against the returns that followed. The correlation came back small and negative, and that number told me more in ten minutes than a week of adjustments would have.
Most beginners skip that step, go straight to fitting a model, and then wonder why the live results look nothing like the test on historical data.
Professionals score their inputs first and throw most of them out before any model runs.
What you’ll build
In today’s post, you’ll build a volatility measure from price data and test whether it predicts returns.
Let’s go.
