Investment Comparator
The Return You Are Not Seeing: Why Dividends Deserve a Seat at the Table
Most investors compare stocks by looking at price charts. It is intuitive, immediate, and almost certainly incomplete. If one asset climbs 40% over five years while another rises only 25%, the conclusion seems obvious. But what if the slower-appreciating asset paid regular dividends that were quietly reinvested the whole time? The actual return gap could be far narrower than the charts suggest, or it could flip entirely.
This is not a hypothetical edge case. For dividend-paying assets like broad market ETFs, international funds, or high-yield equity indexes, the compounding effect of reinvested dividends can account for a meaningful fraction of total return over a multi-year holding period. Ignoring it leads to comparisons that feel rigorous but measure the wrong thing.
To make this concrete, I built Investment Comparator: a local Streamlit app that fetches historical price and dividend data from Yahoo Finance, simulates a Dividend Reinvestment Plan (DRIP), and lets you compare true total returns across multiple tickers side by side.
Why Dividend Reinvestment Compounds So Quietly
The mechanism is straightforward. When a fund distributes a dividend, you receive cash proportional to the shares you hold. Under DRIP, that cash is immediately used to purchase additional shares at the prevailing price. Those new shares then participate in the next dividend distribution, generating more cash, which buys more shares. The compounding is not dramatic quarter to quarter, but over years it accumulates into a gap that price charts simply do not capture.
Consider VOO, the S&P 500 ETF. Its dividend yield has historically hovered around 1.3 to 1.5 percent per year. That sounds modest. But reinvested over five years, with the underlying price also appreciating, the total return diverges noticeably from what a price-only chart would show. The divergence is even more pronounced for higher-yielding assets like international equity funds.
What the Tool Does
Investment Comparator accepts a list of ticker symbols and an initial investment amount, fetches monthly historical data, and runs the DRIP simulation from the chosen start date to today. The results are broken down into three components for each ticker:
- Principal value: what your original shares are worth at current prices
- Dividend value: the additional wealth accumulated from reinvested dividends
- Total value: the sum, which is the only figure that actually matters
The app visualizes these components as interactive stacked area charts using Plotly, so you can see not just where you ended up but how the dividend contribution grew relative to price appreciation over time. A performance summary table reports the final portfolio value, total return percentage, and annualized CAGR for each ticker.
You can also toggle DRIP off entirely, which lets you isolate and compare the pure price-appreciation scenario against the reinvestment scenario for the same asset. That delta is often the most instructive number in the whole analysis.
How to Run It
The app runs locally via a single command. You will need Python 3.11 and uv installed.
git clone https://github.com/kamingfung/investment-comparator-py.git
cd investment-comparator-py
uv sync
uv run investment-comparator
A browser tab will open with the Streamlit interface. From there:
- Enter your tickers as a comma-separated list (e.g.,
VOO, QQQ, VYMI) - Select a time range: 1 year or 5 years
- Set your initial investment amount
- Choose whether to display results as dollar values or percentage returns
- Toggle DRIP on or off
The app supports up to eight tickers simultaneously, each rendered in a distinct color with unified hover states across charts, so comparisons remain readable even when the lines cluster together.
A Note on the Data
All price and dividend history is fetched from Yahoo Finance via the yfinance library. For most major ETFs and equities, the data goes back well beyond the five-year window this tool exposes. Dividend reinvestment is simulated at monthly granularity, which is a reasonable approximation for assets that distribute quarterly. The tool does not account for taxes, transaction costs, or fractional share rounding, so treat the outputs as directional rather than precise.
Closing Thoughts
Price charts are not wrong. They are just partial. For any asset that generates income, the total return picture requires tracking what happens to that income after it is distributed. This tool makes that calculation automatic, so the comparison you are actually making is the one you intended to make.
The code is available at https://github.com/kamingfung/investment-comparator-py. Feedback and contributions are welcome.