DEV Community

Cover image for Bonds vs. Stocks: What “Safer” Actually Costs You
Jaroslav Šmarda
Jaroslav Šmarda

Posted on Originally published at Medium

Bonds vs. Stocks: What “Safer” Actually Costs You

Python for programmers, prompts for data analysts.


"Bonds are safer" is one of the most repeated pieces of investing advice there is. It's not wrong, exactly — but "safer" is doing a lot
of quiet work in that sentence, standing in for a trade-off most people never actually see the size of.

Let's put a bond fund and a stock fund side by side, over the same period, and ask what "safer" bought — and what it cost.

Want to try this yourself? The EODHD MCP Server is what pulled the
data above — connect it to Claude and ask your own questions (affiliate link).

New here? The Setup covers
everything you need before your first prompt.


Ask for the trade-off directly

🟧 PROMPT

Use the eodhd MCP to compare AGG (bond fund) and
VOO (S&P 500 fund) on 5-year returns and
volatility.
Enter fullscreen mode Exit fullscreen mode

AGG (bonds): 5-year return −0.51%, 1-year volatility 3.21%.

VOO (stocks): 5-year return 13.09%, 1-year volatility 13.25%.

The bond fund moved about a quarter as much as the stock fund — and lost money over five years. The stock fund moved four times as
much — and turned a dollar into more than $1.13 in gains alone.

That's the trade laid bare in two numbers: AGG gave up virtually all of the stock fund's volatility, and gave up virtually all of its
return along with it.


Ask why bonds lost money at all

🟧 PROMPT

Bonds are supposed to be the "safe" asset. Why did
AGG lose money over five years?
Enter fullscreen mode Exit fullscreen mode

Bond prices move inversely to interest rates: when rates rise, the price of existing bonds falls, because new bonds get issued paying
more. AGG holds intermediate-term bonds with an effective duration of about 5.8 years — meaning a 1-percentage-point rate increase would
be expected to lower the fund's price by roughly 5.8%. The five years in this window included a sustained rate-hiking period, and that
price decline outweighed the interest income the fund collected along the way.

"Safe" here means something narrower than "won't lose money." It means the loss, when it happens, tends to be small and predictable
compared to stocks — not that a loss is impossible.

Bonds didn't behave unpredictably. Duration is a known, calculable sensitivity — the −0.51% wasn't a bond fund malfunctioning, it was
exactly what a 5.8-year-duration fund does when rates rise as much as they did.


A word of honesty

This comparison used one specific five-year window — one that happened to include a sustained rate-hiking cycle, which is close to the
worst-case scenario for a bond fund's price return. A different five years, especially one with falling rates, would show AGG's price
appreciating instead of declining, alongside its steady interest income.

It's also worth separating two different jobs "safer" can mean. Lower volatility and a smaller expected loss in a downturn are real,
measurable properties AGG has regardless of which five-year window you pick — that part of "safer" held up. What didn't hold up in this
specific window was the assumption that safer also means "won't lose money" or "protects against inflation." Bonds are frequently held
for reasons beyond total return at all — reducing a portfolio's overall swings, or providing cash to draw on when stocks are down — jobs
this single comparison doesn't measure. Not investment advice.


Final Thoughts

This is the twenty-ninth article in the series Unlock Real-Time Market Intelligence with EODHD and Claude, and the first to test the single most repeated
piece of investing advice there is: bonds are safer.

Two prompts put the trade-off in front of an actual number instead of a slogan.

So here's what it cost: over the five years checked, AGG's lower volatility (3.21% vs. VOO's 13.25%) came paired with a 5-year return
of −0.51%, against VOO's 13.09%.
"Safer" wasn't false — the bond fund really did swing less. It just turned out to mean "loses less
dramatically," not "doesn't lose," and in a rate-hiking window, even that smaller loss was still a loss. The word was accurate. It just
wasn't the whole sentence.


If this made you curious, the MCP Server is free to try — The
Setup
walks you through it.


← Part 28: One Number, Two Meanings: What Beta Actually Measures

Top comments (0)