A contrarian strategy that exploits the tendency of country equity markets to revert toward long-term equilibrium values by going long recent losers and short recent winners.

By PyQuant News

Published: 2026-09-30

URL: https://pyquantnews.substack.com/p/your-monthly-alpha-lab-deep-dive-e80


Welcome to your monthly Alpha Lab deep dive.

At the end of each month, you’ll get a deep dive featuring Python code to backtest and analyze a live trading strategy. Remember, you can also drive the conversation and support topics your way. Create new threads to start conversations about the code, strategies, and topics you care about.

In this month’s deep dive inside PyQuant News Alpha Lab, you’ll build and backtest a geographically diversified contrarian strategy: Mean Reversion Effect in Country Equity Indexes.

The idea is simple but powerful—rank country equity ETFs by their performance over the past 36 months, then go long the markets with the weakest returns and short those with the strongest returns, with the expectation that extreme performance will reverse. The strategy selects the 4 worst performers and 4 best performers from a universe of 24 developed and emerging-market ETFs, equal weights positions on each side of the portfolio, and rebalances every three years to align with the long-term mean reversion horizon.

You’ll also walk through the full workflow in Zipline, including country ETF universe construction, 756-day rate-of-change calculation, tradeability and data-history checks, realistic commission and slippage modeling, long-short portfolio construction, three-year rebalancing, and long-term performance analysis. By trading broad country indexes instead of individual stocks, the strategy aims to capture behavioral overreaction and fundamental mispricing across global markets while maintaining geographic diversification and balanced contrarian exposure.

By the end, you’ll have a complete backtest, from ranking winners and losers and constructing the long-short portfolio to backtest execution, plus performance evaluation using CAGR, Sharpe ratio, annualized volatility, and max drawdown.