Nathan Gomes

Current focus  /  Machine-learning equity research

AlphaCast

A research workstation that ranks 98 US large caps by their expected return against their own sector over the next 20 trading sessions, tests six models (five plus an ensemble) on the same walk-forward folds, and turns the ranking into a portfolio it keeps monitoring.

The verdict: Random Forest found the strongest ranking signal (Rank IC 0.024, t = 2.4, p = 0.018) and it survived costs, but much of its excess return is market exposure (beta 1.30), and once six models are compared the evidence is suggestive rather than conclusive (Holm-adjusted p = 0.11). The edge is concentrated in volatile markets, most models did not beat plain momentum, and every model has weakened over the last six months.
Test window
Feb 2017 – Jul 2026
114 monthly folds, out of sample
Universe
98 US large caps · 11 sectors
daily data 2014 – 2026
Models
Momentum baseline · Ridge
Elastic Net · Random Forest
Gradient Boosting · Ensemble
Stack
Python · pandas · scikit-learn
FastAPI · JavaScript · pytest
Mean Rank IC 0.024
t = 2.4 · momentum 0.006
Holm-adjusted p = 0.11
Net Sharpe 1.24
Universe 1.09 · momentum 1.22
Best of six models
Annual return, net 28.3%
Universe 16.6%
11.6 pts ahead
Worst drawdown −21.0%
Universe −16.3%
4.7 pts deeper

Random Forest top-15 equal-weight sleeve, rebalanced monthly, net of 10 bps one-way costs on 41% average monthly turnover. Walk-forward, out of sample, Feb 2017 – Jul 2026. Benchmark: the equal-weight universe over the same periods.

The thirty-second version

1

The signal is small, and only suggestive

Random Forest ranked stocks with a mean Rank IC of 0.024, positive in 59% of 114 months, the only t-statistic above 2 (p = 0.018; bootstrap 95% interval 0.005 to 0.045). Adjusted for testing six models, p rises to 0.11. That is typical of real equity signals: useful as a tilt, nowhere near a forecast.

2

Most machine learning did not beat momentum

Ridge, Elastic Net and gradient boosting all reached about 0.010 IC, above momentum's 0.006 but within noise, and after turnover their Sharpe ratios fell below momentum's 1.22. The machine-learning sleeves also carry more market risk (beta 1.2 to 1.4), which flatters them in a rising decade. Model complexity was not what made the difference.

3

It works in stress and fades in calm markets

In high-volatility months (53 of them) Random Forest's IC averaged 0.055; in calm expansions (60 months) it was -0.004. The monitoring view currently puts all six models on watch: each has a weaker last six months, but no drop exceeds 1.5 standard errors, so none is called degraded. The app shows this rather than hiding it.

02

The application

Built as software people use, not a notebook

The live app opens on the latest signal, precomputed from a Yahoo Finance snapshot that refreshes weekly, so the first screen loads instantly. New studies run in the background with time estimates, a command palette (⌘K) jumps to any stock or view, and every table exports.

AlphaCast overview screen: signal date, model health, generated research read-out, current top ranks and a growth chart
Overview. The latest signal, the active model's record and health, and a read-out generated from the results.
AlphaCast security screen for NVDA: rank, price, per-feature attribution and rank under each model
Security. Why a stock ranks where it does, how its past ranks played out, and its sector peers.
AlphaCast backtest screen: KPIs, growth of one dollar net and gross against the universe, drawdown and rolling active return
Backtest. Net and gross growth, drawdowns, and how the edge holds up as trading costs rise.
SIGNAL

Overview & Screener

Today's ranks with factor profiles, model consensus, rank changes, filters, a watchlist and CSV export.

EXPLAIN

Security

Per-feature attribution, rank history against realised outcomes, rank under every model, sector peers.

ACT

Portfolio

The top-15 book at the latest close: entries and exits, turnover and cost, sector and factor tilts, optional sector cap.

EVALUATE

Backtest & Diagnostics

Growth, drawdowns, cost break-evens, monthly IC, quintiles, within-sector skill and regimes.

COMPARE

Models

Six models on identical folds: IC, t-stat, Sharpe, turnover, today's rank agreement and feature reliance.

WATCH

Monitoring & Runs

Health status, rolling IC bands, reliance and feature drift; background runs on live Yahoo data.

03

Out-of-sample performance

What $1 in the top-ranked sleeve became

Each month the model ranks all 98 stocks using only data up to that close, the top 15 are held equally for the next 20 sessions, and trading costs are charged on every change. Log scale, so equal slopes mean equal percentage growth.

$1 $2 $4 $8 2017 2019 2021 2023 2025 $10.6 $7.5 $4.3 $6.3
Random Forest, netMomentum 12-1, netEqual-weight universeUniverse at Random Forest's beta (1.30x)
How to read it: the light dashed line scales the universe to Random Forest's beta, so the gap between it and the orange line is the part of the gain that market exposure does not explain. The universe itself compounded strongly (a 1.09 Sharpe for an equal-weight basket of today's large caps, flattered by survivorship). Random Forest's edge over it works out to an information ratio of 0.98, bought with a deeper worst drawdown (−21.0% against −16.3%) and 0.49% a year in trading costs. The edge is lumpy: the sleeve beat the universe in 5 of 8 full calendar years, and most of the gain came from 2020, 2021 and 2025.
How much is skill, and how much is risk? The sleeve's beta to the universe is 1.30, so it amplifies a rising market; on a trailing two-year basis it peaked near 1.5 in 2021, around its best stretch of outperformance. The alpha left after removing that exposure is 6.0% a year (t = 1.7), no larger than momentum's 7.0% (t = 1.7, beta 0.97). Neutralising Random Forest's scores to volatility keeps its ranking skill (Rank IC 0.024) but lowers beta to 1.16 and alpha to 4.1%: the stock ordering is real, and some of the return was risk.
04

Did machine learning help?

Six models, one set of folds, one bar to clear

A 12-1 momentum ranking needs no fitting, so it is the honest baseline. Every model saw the same features, the same folds, the same portfolio rule and the same costs. The cumulative IC chart shows whether an edge was persistent or came from a few lucky months.

Cumulative monthly Rank IC

-1 0 1 2 3 2017 2019 2021 2023 2025 2.8
Random ForestEnsembleGradient BoostingElastic NetRidgeMomentum 12-1
ModelMean ICt-statp (Holm)IC > 0Q1 − Q5Net SharpeTurnoverMax DD
Random ForestStrongest0.0242.410.1159%0.80%1.2441%−21.0%
Ensemble (declared in advance)0.0181.640.5257%0.50%1.0742%−22.8%
Gradient Boosting0.0100.971.0045%0.33%1.0657%−22.8%
Elastic Net0.0100.801.0049%0.38%0.9035%−23.3%
Ridge0.0100.751.0050%0.41%0.8046%−27.4%
Momentum 12-1 (baseline)0.0060.371.0054%0.23%1.2225%−21.1%
Equal-weight universe—————1.09—−16.3%
Beware the winner. Random Forest was picked out after seeing five results, which is itself a small selection bias. The ensemble, an equal-weight average of the four machine-learning models' ranks fixed before any results, is the fairer estimate of what "using ML" delivers: Rank IC 0.018 (t = 1.6) and a net Sharpe of 1.07. Better than any single linear model, short of the best tree model, and not conclusively better than momentum.
The answer is mixed. Tree ensembles can capture interactions the linear models miss, and Random Forest's IC line climbs steadily through 2020 and 2022. Gradient boosting, the more flexible tree model, traded more and gained less. The linear models end up close to momentum once costs are counted.
05

When does it work?

The signal is not stationary

Each month is labelled using only trailing information: the universe's 63-session return sets expansion or contraction, and 20-session volatility above the training window's median sets high volatility. These labels are diagnostics, never inputs or tuning targets.

Regime (Random Forest)MonthsMean ICIC > 0Monthly active return
Expansion / low vol60-0.00447%+0.50%
Expansion / high vol290.05976%+1.57%
Contraction / high vol240.05167%+1.14%
Contraction / low vol10.106100%+1.28%
Most of the edge comes from volatile markets. In calm expansions, the most common state, the ranking was indistinguishable from random. The last six folds average an IC of -0.028, 1.2 standard errors below its earlier record, which is why the monitoring view has the model on watch going into the Sep 2026 signal.

Rank IC by forward horizon

0.000 0.010 0.020 0.030 5 sessions 10 sessions 20 sessions 40 sessions 60 sessions
Random ForestEnsembleMomentum 12-1
The signal is slower than the horizon it was trained for. Scored against longer windows, Random Forest's IC does not fade: 0.038 at 10 sessions and 0.038 at 60, against 0.024 at 20. So I tested trading the book quarterly instead: average monthly turnover fell from 41% to 18%, but net Sharpe dropped from 1.24 to 1.13. The ranking stays informative for longer, yet holdings chosen three months ago cost more than the trading they save.
06

Costs and concentration

How much trading and concentration the edge can carry

Every period stores gross return and turnover, so net results can be rebuilt at any trading cost. The same history shows where the ranking works inside each sector and where the top-ranked sleeve leans.

Net Sharpe against one-way trading cost

1.05 1.10 1.15 1.20 1.25 0 bps 20 bps 40 bps 60 bps 80 bps 100 bps
Random Forest, net SharpeMomentum 12-1, net SharpeUniverse Sharpe
The risk-adjusted edge is thin. Random Forest's net Sharpe falls to the universe's at about 78 bps one way; momentum, which trades less, holds on to about 91 bps. Below roughly 43 bps Random Forest has the better net Sharpe; above it, the simpler baseline wins. Large-cap trading costs are usually well below either, but the margin is not wide. A holding buffer, which keeps a stock until it drops out of the top 23 rather than the top 15, cut turnover from 41% to 28% a month at a similar net Sharpe (1.28); the saving in trading is real, the change in Sharpe is within noise.
It does not hinge on holding exactly 15 names. Rebuilding the same scores as books of 5 to 30 names keeps Random Forest's net Sharpe between 1.15 and 1.28. Its active return rises from 3.6% a year at 30 names to 21.5% at 5: the higher a stock ranks, the more it tends to beat its sector, which is what an informative ranking should do.
Sector (Random Forest)NamesWithin-sector ICIC > 0Active weight
Energy60.01649%+9.2%
Information Technology160.04352%+3.7%
Real Estate4-0.03544%+2.8%
Materials50.01051%+2.4%
Consumer Discretionary100.05257%+1.4%
Industrials100.01347%+0.4%
Communication Services80.06858%−1.7%
Utilities4-0.10939%−1.8%
Financials12-0.00647%−4.3%
Health Care140.04662%−5.9%
Consumer Staples9-0.02641%−6.4%
The sleeve leans, and capping it trades return for risk. On average the top 15 carried +9.2% more Energy than the universe. Capping Random Forest at two names per sector left its net Sharpe unchanged at 1.24, while volatility fell from 22.3% to 19.5% and the worst drawdown from −21.0% to −18.7%. Sectors with four or five names give noisy ICs.
07

How it works

From daily prices to a monitored portfolio

01  DATA

Point-in-time panel

Adjusted prices and volume for 98 stocks. A quality gate drops sessions Yahoo published for under 90% of the universe.

yfinancepandas
02  FEATURES

14 trailing signals

Momentum, risk, liquidity and sector-relative strength, ranked within each date so decade-long level drift cannot leak in.

NumPypandas
03  MODELS

Embargoed walk-forward

Expanding windows stop 20 sessions before each test month. Weekly-sampled training, quarterly refits, winsorised labels.

scikit-learn
04  PRODUCT

API and workstation

Background runs, live scoring, attribution, drift and health checks served to a dependency-free JavaScript app.

FastAPIJavaScriptRender
08

Validation

Why the numbers can be trusted, and where they cannot

Leakage controls

Every label starts after its decision

Features use data through the decision close; the 20-session target starts the next session; training ends 20 sessions before each test date so labels never overlap. Stale quarterly fits can only be older, never newer.

Tested: embargo, month-end folds, sampler equivalence, and a shuffled-data placebo that must show no skill

Engineering

Bugs found by inspecting the data

Building the app surfaced a forward-return shift that crossed ticker boundaries, a Yahoo session published for 28 of 98 stocks, and a truncated final month counted as a fold. Each is fixed and covered by a regression test.

46 pytest cases · interface tests · axe accessibility audit · CI on every push

Deliberately not claimed

What this cannot show

The universe is today's large caps, so results carry survivorship bias. There are no point-in-time fundamentals, delisting returns, borrow costs, taxes or market-impact model, and no portfolio optimizer.

Stated in the app, the README and here

Explainability

Attribution for every ranked stock

Each score is decomposed by setting one feature at a time to the day's median. The decomposition is exact for the linear models and a local approximation for trees; reliance is compared across models on one scale.

Occlusion attribution · reliance drift
09

Next research iteration

Strengthen the data before expanding the claim

Point-in-time constituents to remove survivorship bias, point-in-time fundamentals, and a spread and impact cost model. Each goes through the same chronological validation before it can support a stronger conclusion.

Quantitative research

Cross-sectional signal design, rank IC and quintile analysis, walk-forward validation with an embargo, regime diagnostics.

Rank ICWalk-forwardRegimes

Machine learning

Six comparable models including an ensemble fixed in advance, declared hyperparameters, label winsorisation, occlusion attribution, placebo tests and drift monitoring.

scikit-learnRandom ForestPSI

Software engineering

Background job API, multi-view JavaScript workstation, performance profiling, tests, CI and Docker deployment.

FastAPIJavaScriptpytest

Try it

Open the workstation and inspect today's ranks

The free instance may take a minute to wake up. Nothing in AlphaCast is investment advice.