My First Finance Project: When Diversification Doesn't Diversify

Published: (January 19, 2026 at 07:53 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for My First Finance Project: When Diversification Doesn't Diversify

Code and Readme with more financial and technical details is located here

Motivation

Recently, I’ve been feeling a lot of passion for the financial domain after reading several interesting books. As any good programmer will tell you, the best way to learn is by sinking your teeth into a problem and stumbling a few dozen times.

Growing up in Cambodia, I frequently noticed a large dissonance between how media reported on Cambodian politics and the economy compared to what was actually happening. Major, potentially groundbreaking events often didn’t become news. When following stocks such as NagaCorp Ltd, I wondered how much less efficient the market would be with far less information to work with and to what degree risk was accurately reflected.

Hypothesis

There is no statistically significant difference in risk‑adjusted returns between ETFs tracking high‑risk and low‑risk country indices.

I chose ETFs because manually grouping individual stocks would introduce issues such as survivorship bias and the need to account for countries changing classification during the selected period.

Data and Methodology

  • The financial data was already clean, so I could create a few Pandas DataFrames, align them, and start the analysis.
  • I compared the performance of ETFs tracking:
    • S&P 500 (developed market benchmark)
    • Emerging Markets
    • Frontier Markets
  • I examined both absolute returns and risk‑adjusted metrics, focusing on periods of market stress.

Findings

  • The S&P 500 outperformed both Frontier and Emerging Markets by roughly 10 % annually.
  • Correlations with the S&P 500 were moderate (0.70 for Emerging, 0.61 for Frontier), suggesting some independence on paper.
  • However, during the S&P 500’s 10 worst months, both Emerging and Frontier Markets suffered severe losses—about 85‑91 % as bad as the S&P 500 itself.
  • The diversification benefit largely disappears when it matters most: when the S&P 500 drops, Frontier Markets tend to fall even harder despite their lower overall correlation.

Takeaways

  • Based on this analysis, I would keep the bulk of investments focused on established markets.
  • The project highlighted that diversification benefits can be illusory during market downturns.
  • It also reinforced the importance of having a clear problem statement and exploring the best ways to answer it, rather than relying solely on high‑level metrics.

If you’re interested in the deeper financial analysis, feel free to check the GitHub repository linked above or send me a message!

Back to Blog

Related posts

Read more »

Rapg: TUI-based Secret Manager

We've all been there. You join a new project, and the first thing you hear is: > 'Check the pinned message in Slack for the .env file.' Or you have several .env...

Technology is an Enabler, not a Saviour

Why clarity of thinking matters more than the tools you use Technology is often treated as a magic switch—flip it on, and everything improves. New software, pl...