Python for programmers, prompts for data analysts.
A high correlation number looks like proof of something. Two lines on a chart, rising and falling together — surely that means one
drives the other, or at least that something real connects them.
Sometimes it does. Sometimes it's a coincidence dressed up as a statistic — two numbers that happened to trend the same way over the
same stretch of time, with no relationship between them at all. Let's find a pair like that, and see what correlation alone can't tell
us.
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.
Find two things that shouldn't be related
🟧 PROMPT
Use the eodhd MCP to compare AMZN's monthly price
against global sugar prices from May 2023 to
January 2026, and calculate the correlation.
Correlation coefficient: −0.887. Over those 33 months, as sugar prices fell, Amazon's stock rose — and it did so with a consistency
that would usually be read as a strong, meaningful relationship. On a scale where 0 means no relationship and ±1 means perfect lockstep,
−0.887 is close to as tight as real-world financial data ever gets.There is no supply chain, no economic mechanism, and no plausible causal story connecting the world sugar market to Amazon's stock
price.
A correlation this strong, between two things with nothing to do with each other, is exactly the trap this article is about.
Zoom out and watch it fall apart
🟧 PROMPT
Now calculate the same correlation over the full
period, January 2021 to July 2026, instead of
just that one window.
Over the full 67 months, the correlation between AMZN and sugar prices drops to −0.579 — still negative, but noticeably weaker than
the −0.887 we found by picking the 33-month stretch that happened to line up best.That's not a data error. It's what happens when you search enough time windows: somewhere in almost any two unrelated series, a
stretch exists where they happen to move together more tightly than chance alone would suggest. The tighter number wasn't a discovery —
it was the result of looking until something matched.
This is the trap correlation-hunting sets for itself. Scan enough starting points, enough window lengths, enough pairs of tickers, and
you will find an impressive number eventually — not because you found a relationship, but because with enough attempts, coincidence
starts looking exactly like one.
A word of honesty
A correlation number, however strong, never tells you why two things moved together — and that's the whole problem with stopping here.
A more rigorous test exists: cointegration, which checks not just whether two series move together over one window, but whether they
share a stable, long-run equilibrium relationship that persists across time and would be expected to hold up out of sample. AMZN and
sugar prices would almost certainly fail that test — there's no economic reason to expect one to anchor the other. Correlation asks "did
these move together, this one time?" Cointegration asks a harder, more honest question: "is there a real, structural reason to expect
they'll keep doing it?"
The deeper lesson: any time a correlation is discovered by scanning many windows, many pairs, or many parameters — rather than proposed
first and tested once — treat it as suspect by default. The sugar-and-Amazon relationship above wasn't found because someone
hypothesized a link and checked. It was found because the exact opposite happened: we looked for a coincidence, and finance has an
almost unlimited supply of them. Not investment advice.
Final Thoughts
This is the twenty-sixth article in the series Unlock Real-Time Market Intelligence with EODHD and Claude, and the first one that manufactured its own trap
on purpose — deliberately hunting for a coincidence to show how easy coincidences are to find.
Two prompts built the illusion, then took it apart.
So here's where it lands: the same two series — AMZN's stock price and the world price of sugar — showed a correlation of −0.887 in
one carefully chosen 33-month window, and only −0.579 across the full six years. Neither number means Amazon's stock is driven by
sugar. What the gap between them means is simpler and more useful: a correlation you found by searching is a different kind of evidence
than a correlation you predicted and then checked. Ask which one you're looking at before you trust either.
If this made you curious, the MCP Server is free to try —
The Setup walks you through it.
← Part 25: Hundreds of Lines, One Sentence: Backtesting Without the Code
Top comments (0)