idx-newsflow: what I built and what I measured
I rebuilt my Indonesian market-news bot as a small data platform on a 2 GB server. Here is how it's put together, what I measured, and what it doesn't claim.
idx-newsflow collects Indonesian market news, scores each headline for sentiment, links it to IDX tickers and sends a digest to Telegram. Telegram is only where the results show up. Most of the work is the pipeline behind it, and the measurements that say how far to trust it.
Why I rebuilt the old bot
It replaces a bot I ran on GitHub Actions since July. When I looked at it closely in October, two things were wrong, and neither had ever made a run fail.
Most of its feeds were empty. It had 13 RSS feeds. Six had moved, died or started serving web pages, and three more refuse GitHub’s servers. So from where it ran, 9 of the 13 returned nothing, and all 203 of its runs were green, because the old code only complained when a request raised an error. In idx-newsflow, a feed that parses to zero items fails the run, and the failure raises an alert.
It scored without half its model. The sentiment model was saved with an older scikit-learn. Loaded under the version the bot installed, the vectorizer silently dropped its IDF weights, so every word in a title counted the same.
| Measured on the 9,819 training titles | As trained | As the bot ran it |
|---|---|---|
| Held-out accuracy | 0.816 | 0.798 |
| Held-out macro-F1 | 0.812 | 0.792 |
| Labels that differ | 585 (6.0%) |
idx-newsflow loads the same files, restores the weights, and a regression test pins the scores to the original.
How it’s built
8 RSS feeds · every 30 min
▼
raw/ · append-only Parquet
▼
DuckDB · dbt: staging → 11 marts
├─ sentiment tfidf-lr-v1
├─ tickers aliases-v2
▼
Telegram · 07:00, 12:30, 20:00 WIB
- Collection. Every 30 minutes, around the clock. Each response is written once to a raw layer that is never edited, and loading it twice adds nothing, so the warehouse can always be rebuilt from the raw files. A headline’s time is when I first saw it, not the time the publisher claims.
- Modelling. dbt builds staging, intermediate and 11 mart models in DuckDB. Tests on keys, allowed values, probabilities and time rules fail the build, and the data dictionary is generated from the same model files.
- Scoring and linking. The model is
tfidf-lr-v1, TF-IDF plus logistic regression, trained on CNBC Indonesia titles. The linker,aliases-v2, matches the 45 LQ45 companies, the composite index and two names from my watchlist. - Orchestration. systemd timers start one-shot Dagster jobs that share a lock, because DuckDB takes one writer. On the server, a resident Dagster daemon peaked at 1,153–1,304 MB, against about 1,960 MB of RAM in total. A one-shot run peaks at about 590 MB and then exits.
The budget is $0, and that ruled out a price feed: none of the five free market-data APIs I checked covers IDX under terms that allow public display.
The digest
Three scheduled digests a day, each covering the time since the last one. The cover is one message with buttons. Drill-downs edit that message in place: market-wide stories by topic (IHSG, the rupiah, interest rates, bonds, commodities), each company, my watchlist, and two charts, the window’s sentiment balance and a 7-day trend.
The same story often runs at several outlets, so dedupe-v1 groups titles into stories by character n-grams and shared numbers, with guards for opposite directions and repeated templates. In the first 15 hours, 679 headlines became 618 stories.
Watchlist alerts run hourly, not in real time: a headline can take up to about 1 h 40 min to raise one. There is at most one per ticker every 3 hours, and none in quiet hours, 22:00–06:00. Every cover, alert and chart says “Bukan rekomendasi investasi” (not investment advice).
Shipping it without breaking it
- Code-only deploys. Changes that touch no unit, timer, secret or server config can go out once CI passes.
- One-command rollback.
deploy/rollback.sh <commit>restores the previous release, and its dry run is checked before each deploy. - A listener check after each deploy.
bot-checkconfirms the restarted bot is polling Telegram and that/statusanswers. - The old release has to work on new data. Before shipping ratings and settings, I ran the release then live on a warehouse written by the new code, and its dbt tests passed. Settings got their own log for exactly that reason.
- Measure before adding weight. Charts brought in matplotlib, so I measured a render on the server first, with a rule to stop if available memory fell below 300 MB. It fell from 1,503 MB to 1,454 MB at its lowest.
The 48-hour unattended run is counted strictly: any failed run of any job restarts the clock. One earlier window ended on a real failure, when the first on-demand digest called a command-line option that doesn’t exist. The current window ran from 13 Oct 19:42 to 15 Oct 19:42 WIB and included four code deploys. Its report isn’t written yet, so I’m not claiming the run here.
What I measured, and how much it says
Few headlines name a company. In the first 15 hours, 89 of 679 headlines (13%) linked to a ticker, the index included. That is why the digest has a market-wide section.
De-duplication precision is known only roughly. I hand-marked 10 merged groups drawn at random. 7 of the 10 were the same story: 70%, with a 95% interval of 40–89%. With the market-move guard, which splits the same headline template on different days, 7 of 8: 88%, interval 53–98%. That’s a small sample, and it says nothing about stories that should have merged and didn’t. The guard’s threshold, 15 hours, sits between the widest same-story spread I saw (12.7 h) and the narrowest repeat (18.3 h). It’s fitted on a few cases, so it stays provisional until I re-check it on two weeks of data.
Ticker linking isn’t measured yet. I’ve drawn 200 headlines to label: all 75 the linker linked, and 125 of the 467 it didn’t. None are labelled yet, so there’s no precision figure, and the digest’s ticker links are unverified.
Sentiment accuracy, from ratings. Every story card has buttons to rate the model’s label. /nilai serves random headlines to rate, which gives an unbiased accuracy estimate with a 95% interval. Ratings I give while browsing are kept separately and labelled as what they are: a sample I chose, so agreement there isn’t accuracy.
What it doesn’t do
- The model doesn’t learn from ratings. They’re stored so every later model version can be scored on the same labels.
- Its accuracy on these outlets isn’t known yet. It was trained on CNBC Indonesia titles from 2024–25, how those labels were made is unknown, and its probabilities aren’t calibrated.
- There’s no price data. So there’s no claim that sentiment predicts returns. Testing that needs a price source first, and it isn’t done.
- It isn’t advice. Every digest says so.