What the filter keeps
Text that is not an exact repeat, not a wall of numbers, and not a near-duplicate of something already kept. A stricter mode can also require the company name and a TF-IDF match to that name.
Financial news is noisy. This pipeline keeps the articles about one company, scores what they say, and estimates the return over the next five trading days.
A pattern no single article spells out. It shows up when many stories are read together: shared themes, framing, source bias, and the way a narrative drifts.
Ingest lands in Postgres. Embeddings and judged scores are computed locally. The map and the model are written back beside the articles they came from.
Read the story, then the number. The same run that stores an article also stores where it sits among other stories and what the model expects next.
Pipeline overview ↗A high-level view of one ticker’s path from a news API to a return estimate. The pictures are illustrations. The numbers are the ones the pipeline actually uses.
A run pulls articles for one symbol, shapes them into a common record, drops noise, and writes what remains to Postgres.
Latest or archive pages, with retries around the client.
Source, text, and dates land in a checked schema.
Exact copies go first. Near-copies follow.
Filtered articles become the rows later stages read.
Text that is not an exact repeat, not a wall of numbers, and not a near-duplicate of something already kept. A stricter mode can also require the company name and a TF-IDF match to that name.
Reposts, number-heavy blurbs, and articles that only brush the ticker. Near-duplicates are dropped by cosine similarity on TF-IDF, so a rewrite of the same story does not get a second vote.
One reading is a vector. The other is a set of scores. Both come from the article text, and both stay tied to that article.
The embedding is a position. Articles that read alike land nearer each other once that vector is projected.
Four prompts score the article independently. The model later uses the average of each score, not the raw essay.
Is the company the subject, and does the event look financially direct?
Focus, salience, materiality, urgency.A mention can be a drive-by, a rumor, or a story about something else.
Drift, distance, hypotheticals.Numbers, named sources, and a line of reasoning raise the score.
Specificity, citations, rigor.Promotion, anonymous claims, and recycled copy pull the other way.
Opacity, tone, incoherence.Prompt registry ↗ · 6 scores in each family, 24 in all.
Normalized embeddings are projected to 50 dimensions, then grouped. The picture below is a flat sketch of that neighborhood.
Every point is one article. Distance here is a drawing of the idea, not a fitted UMAP.
The real map is 50-dimensional. A review screen draws a 2D view from the workspace and colors it by cluster.
The regressor does not read the cluster id. It reads the judged-score averages and the market’s move on the anchor day, then estimates the cumulative log return that follows.
Averaged per article. Those averages are the text features.
The target sums daily log returns on that horizon.
The latest slice of articles is the check, not a random draw.
| Piece | What it uses | Where it lives |
|---|---|---|
| Anchor day | First trading day on or after the article date, and that day’s log return. | Market CSV for the symbol. Polygon fills it when needed. |
| Target | Cumulative log return across the five-day window after that anchor. | Built in the dataset step. Column name car_5d. |
| Features | Averages of the 24 judged scores, plus the anchor day’s log return. | Training table written under the run directory. |
| Model | Histogram gradient boosting. Depth 4, fixed seed, chronological holdout. | .joblib under the run’s model folder. |
A local Flask app reads the SQLite workspace: articles, batch jobs, scores, the cluster map, and model rows. Derived fields are also written back to Hasura.
Open a row and check the text against the parsed metrics. Failures stay visible in the batch and run tables.
A 2D view of the embeddings, colored by the k=50 assignment, with a way through to the article.
UMAP coordinates and cluster metadata land on embedding_umap. The metric row records which model scored it.
The review UI is read-only. It opens the newest symbol workspace, or a database path you pass in. Use it to see whether a run finished cleanly.
Hasura keeps the article, its embedding row, and its metric row linked. The next run can read that scope instead of starting from loose files.
A pipeline from headline to horizon.
Ingest, scores, a map of the coverage, and a five-day return estimate, with the workspace left open for review.