DEV Community

Cover image for Putting expert quotes on real price charts, without letting the AI make things up

Putting expert quotes on real price charts, without letting the AI make things up

News aggregators answer "what happened". Readers usually want the next question answered: so what changes for me? I added two features to Ruri Jupjup, a free Korean information site I build with an AI coding agent:

  1. an "impact on my life" card under news issues, and
  2. a "what experts said vs what the market did" page that plots named expert statements as dots on real price charts and checks them 7 and 30 days later.

The constraint was strict: no invented sentences, no invented numbers, and no server. Here is how it is built.

Expert statements on a 30-day price chart, with impact card

1. A rule table instead of generated text

If a model writes "this could raise your loan interest" on the fly, it will eventually write something plausible and wrong. So impact sentences come only from a hand-written JSON rule table.

  • 10 rules: interest rates, FX, oil, housing, semiconductors, stocks, crypto, prices, policy, security
  • each rule = keyword regex + 1–3 lines of "who is affected → what may change → where to check (link)" + a small gauge (my wallet / daily life / schedule: low, mid, high) + which market series to attach
  • wording is always conditional ("may", "can"), and every card ends with general information, depends on your situation, not investment advice
  • issues containing death/accident terms never get a card (1 of 60 today)

Result on today's build: 7 of 60 news issues and 7 of 26 trending topics matched a rule and got a card. Most issues do not affect a household budget, and the card simply does not appear for them.

Numbers in a card come only from the article headline (a regex for %, %p, won, dollars, bp and dates), printed next to the outlet and title so there is never a number without a source.

2. Public price data, checked against robots.txt

Series Source Days
S&P 500, Nasdaq Composite, KRW/USD, WTI, US 10-year FRED public CSV (fredgraph.csv?id=…), allowed for User-agent: * 81–83
Bitcoin (KRW) Upbit public API, daily candles 120
KOSPI, Korean bonds, a chip index no free source that allows crawling yet → statements only —

Six series download in 1.6 s into a 12.8 KB JSON file, once a day. The hourly site build only reads that cache. If one series fails, it keeps yesterday's values for that series only.

3. Checking statements after the fact

  • value on the statement date = that day's close, or the last trading day before it
  • value 7 days later = first trading day on or after date + 7; until then the page says "check on 10/27"
  • an optimistic statement followed by a rise (or a cautious one followed by a fall) is shown as "moved as stated", otherwise "moved the other way": facts only, no mocking
  • a per-institution leaderboard appears only after 5 judged statements; below that the page shows "sample N"

Right now there are 15 named expert statements in 30 days and 0 judged, because collection started on 10/16 and no 7-day window has closed yet. The rule "don't rank before there is data" is visible on the page instead of hidden in code.

4. Static JSON + one SVG path

There is no charting library. At build time each chart is a single SVG path plus circles for statements; the only script opens the headline and source link when a dot is tapped. FRED lags a day or two, so statements newer than the last price point used to pile up at the right edge. The fix: extend the axis to today and draw dots right of a dashed "no data yet" line in a lighter colour.

Size of the whole thing: impact code 62 lines + rule JSON 44 lines, market module 86 lines. A full site build takes about 89 s and the site is plain static HTML on GitHub Pages.

5. Opinion lives in a labelled box

The same data feeds a weekly commentary piece, for example why "AI bubble" talk came back the day the Nasdaq rose 1.1%. It keeps facts (with links), the conflicting expert quotes, the actual index moves and the impact card separate from opinion, which sits in its own clearly labelled box.

Commentary page: facts, conflicting statements, real index moves

Try it

Built with an AI coding assistant; all numbers re-measured on the 2026-10-20 build. General information, not investment advice.

Top comments (0)