PyQuant News is on Substack

Looking for the newest weekly Python deep dives for algorithmic trading, market data analysis, and quant finance? Subscribe to the PyQuant Newsletter on Substack for free.

Subscribe for free 👉

Build a volatility factor strategy with 0.84 Sharpe

October 4, 2025
Facebook logo.
Twitter logo.
LinkedIn logo.
Newsletter issue count indicatorNewsletter total issues indicator
Build a volatility factor strategy with 0.84 Sharpe

Build a volatility factor strategy with 0.84 Sharpe

I was reviewing my own portfolio allocations this weekend and realized how much I still lean on low volatility names, even when markets get noisy.

A lot of beginners get stuck thinking that safer stocks mean lower returns. This comes from old ideas about risk, which break down when you look closer at the data.

Students in Getting Started With Python for Quant Finance learn to use Python to screen for low volatility stocks, build risk-adjusted portfolios, and backtest these strategies so they see how compounding and risk management really work.

Today’s newsletter walks through a piece of the end-to-end process my students master in full.

By reading today’s newsletter, you’ll get Python code to build and backtest a low volatility equity portfolio with cleaner drawdowns and improved risk-adjusted returns.

Let's go!

Build a volatility factor strategy with 0.84 Sharpe

The low volatility factor is a systematic way to prioritize stocks with lower price fluctuations and lower beta compared to the broader market. It allows investors to seek higher risk-adjusted returns through steady compounding and lower drawdowns over market cycles.

The history of the low volatility factor began with empirical anomalies in finance theory.

Decades ago, researchers noticed that low volatility stocks delivered better risk-adjusted returns than more volatile names. Academic evidence, notably the work of Baker and Haugen, challenged the classic risk-return tradeoff, showing "safer" stocks could outperform in the real world. Now, minimum volatility indices like those from S&P and MSCI formally track and publish performance data to demonstrate the effect globally.

Today, the low volatility factor is integral for practitioners looking to temper portfolio swings without sacrificing long-term returns.

Practitioners use systematic screens based on historical volatility or beta to select these stocks, often relying on ETFs like SPLV and USMV for broad exposure. They rebalance portfolios regularly to maintain risk levels, carefully monitor sector exposure, and frequently blend factors like value or quality for stronger risk-adjusted returns.

Let's see how it works with Python.

Imports and setup

This example uses the free Quandl data for backtesting. The pro is it’s free. The con is it is limited in universe size (about 3,000 stocks) and time (data ends in 2018). Despite the drawback, it’s a great way to get started.

To use it, create a free API key at Nasdaq. Then run the following code.

We use warnings to filter messages, numpy and pandas for fast calculations, and Zipline libraries for running backtests. We also set a few key parameters we’ll use for the strategy.

Build custom stock factors

Here, we define a custom factor to measure weekly volatility and build a pipeline that selects stocks with the lowest volatility from higher-volume names.

In this block, we create a special stock ranking that calculates how much a stock’s price jumps around from week to week over the last three years. We only consider stocks with good trading volume. We then sort these stocks and filter down to those with the most stable (least volatile) prices, forming our candidate list.

By defining a custom calculation for weekly volatility, we’re able to focus on stocks with lower risk. The pipeline groups our target stocks by filtering out those that don’t trade enough and then scoring what’s left, so each month we can focus on the most stable performers. This process uses Zipline’s factor modeling tools, making it easy to plug into the rest of our analysis. We return a data pipeline that tags each qualifying stock with its volume, its volatility, and a flag for inclusion in our portfolio.

Configure and execute the trading strategy

Next, we set up our strategy to use the custom data pipeline, schedule when we rebalance, and decide which stocks to hold at each rebalance.

This code ties everything together for live backtesting. Each month, we update our list of low-volatility stocks and assign equal weights to each, selling anything that’s no longer in our target group.

When nothing in our group can be traded that day, we exit all positions. We also make sure to clean up any outstanding orders before placing new ones to avoid unnecessary trading. Scheduling and pipeline hooks make the whole process hands-off once started, keeping our portfolio focused and up-to-date.

Run backtest and plot results

Now, we set the backtest period, run the simulation using Quandl US price data, and graph how the strategy’s value grows over time.

Here, we run a full portfolio simulation over three years, tracking how a $100,000 account grows if we always hold the least volatile, high-volume US stocks. Zipline uses actual historical pricing from Quandl, making the results realistic for live trading.

The plot gives us a clear picture of how steady or bumpy our approach might feel in the real world. By checking this chart, we quickly see if our low-volatility approach actually produced smoother and stronger returns than just holding the market.

The equity curve will look something like this.

Build a volatility factor strategy with 0.84 Sharpe - Python code output chart

The average sharpe ratio of this strategy over the last year of the analysis is 0.84. A promising result!

Your next steps

You’ve now got a live backtest tracking low-volatility stock performance. The most obvious thing to do is run the backtest through today. Check out Norgate Data to learn how to get up to date data.