SELSUS
01 / THE IDEA

From a news story
to a latent signal,
to a five-day return.

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.

What is a latent signal?

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.

News ingestEmbeddingsReturn model
Three articles connect to three clusters Article 1 links to the Material cluster, Article 2 to Mixed, and Article 3 to Peripheral. LATENT MAP Material Mixed Peripheral

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 ↗
HOW TO READ THIS

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.

02 / INGEST

Collect, clean,
and keep the useful text.

A run pulls articles for one symbol, shapes them into a common record, drops noise, and writes what remains to Postgres.

01 · COLLECT NewsData, one symbol

Latest or archive pages, with retries around the client.

02 · NORMALIZE One article shape

Source, text, and dates land in a checked schema.

03 · FILTER Duplicates and noise out

Exact copies go first. Near-copies follow.

04 · PERSIST Hasura / Postgres

Filtered articles become the rows later stages read.

collect → normalize → filter → persist. Run metadata stays in a local SQLite log.
A

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.

Filter stages ↗

B

What it drops

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.

Ingest architecture ↗

NewsNewsData.ioEnglish US coverage in the sample config. One search term per run.
PricesPolygon daily barsAdjusted daily aggregates. Used later for the return target.
StorePostgres via Hasurasource, unfiltered article, article, embedding, llm metric.
Floor50 scoped articlesClustering asks for at least as many rows as clusters.
03 / SCORING

Two readings of
the same article.

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.

A

Where the text sits

Article text becomes a normalized embedding text embedding
text-embedding-3-large → L2 normalize

The embedding is a position. Articles that read alike land nearer each other once that vector is projected.

B

What the text claims

Four score families, each a set of values from 0 to 1 impact noise quality deficits
each score ∈ [0, 1]

Four prompts score the article independently. The model later uses the average of each score, not the raw essay.

01

Business impact

Is the company the subject, and does the event look financially direct?

Focus, salience, materiality, urgency.
02

Peripheral noise

A mention can be a drive-by, a rumor, or a story about something else.

Drift, distance, hypotheticals.
03

Evidence quality

Numbers, named sources, and a line of reasoning raise the score.

Specificity, citations, rigor.
04

Quality deficits

Promotion, anonymous claims, and recycled copy pull the other way.

Opacity, tone, incoherence.

Prompt registry ↗ · 6 scores in each family, 24 in all.

04 / LATENT MAP

Similar stories
share a neighborhood.

Normalized embeddings are projected to 50 dimensions, then grouped. The picture below is a flat sketch of that neighborhood.

ILLUSTRATIVE MAP

Highlight a kind
of coverage.

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.

Illustrative article map with three coverage groups illustrative axes
Not a model output. Groups stand in for kinds of coverage. Material Mixed Peripheral
NormalizeL2 unit lengthApplied before either projection.
ProjectPCA 50 and UMAP 50UMAP uses cosine distance, 30 neighbors, min dist 0.2.
ClusterKMeans, k = 50Fit on the UMAP vectors. Seed fixed at 42.
Publishembedding_umapCoordinates and cluster metadata link back to the article.
05 / THE RETURN

Scores become
a five-day estimate.

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.

24

Judged scores

Averaged per article. Those averages are the text features.

5

Trading days

The target sums daily log returns on that horizon.

20%

Held out by date

The latest slice of articles is the check, not a random draw.

car_5d = sum of daily log returns over the five-day window
How a story becomes a return estimate
PieceWhat it usesWhere it lives
Anchor dayFirst trading day on or after the article date, and that day’s log return.Market CSV for the symbol. Polygon fills it when needed.
TargetCumulative log return across the five-day window after that anchor.Built in the dataset step. Column name car_5d.
FeaturesAverages of the 24 judged scores, plus the anchor day’s log return.Training table written under the run directory.
ModelHistogram gradient boosting. Depth 4, fixed seed, chronological holdout..joblib under the run’s model folder.
The map and the model answer different questions.

Clusters describe which stories resemble each other. The return model asks what those judged scores imply for the next five sessions. Both are saved. Only the scores and the anchor return train the regressor.

06 / REVIEW

Look at the run
before trusting it.

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.

  1. Articles and scores

    Open a row and check the text against the parsed metrics. Failures stay visible in the batch and run tables.

  2. Cluster map

    A 2D view of the embeddings, colored by the k=50 assignment, with a way through to the article.

  3. Write-back

    UMAP coordinates and cluster metadata land on embedding_umap. The metric row records which model scored it.

Workspace for the operator.

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.

Postgres for the record.

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.

Back to the idea ↑