Peter Laffey

Large Price Model

PYTHONTRANSFORMER20 CHANNELSSPY 15-MIN

Research: can a language-model architecture learn structure in 15-minute SPY sequences? It does — in the shape of the output distribution. Log-loss 3.180 vs linear 3.333 across five seeds.

targetSPY 15-min return
sequences20 parallel channels
train window2015 – 2022
buckets32 quantiles
log-loss3.180 vs linear 3.333
testspytest 629 passing

The pipeline

TOKENIZE · TRAIN · SIMULATE
01 TOKENIZE

For each 15-minute bar the model outputs a probability distribution over 32 buckets of the next return. The buckets are quantiles of the training-set return distribution, so each holds roughly the same number of training examples. Return prediction becomes bucket classification — the task a language-model architecture is built for.

02 TRAIN

The model reads eight years of 15-minute bars — 2015 through 2022 — across twenty parallel time series. One is SPY. The rest carry other stocks, currencies, macro releases, options data, and calendar events. A normalizer scales each channel using statistics computed only over 2015-2022.

03 SIMULATE

At each bar the simulator reads the distribution, decides open / hold / close, and records the trade. Sharpe reports at the end — average return over volatility, annualized, with a block-bootstrap error bar.

IN DEPTH
01 — What it is

A transformer predicts the next fifteen-minute return of the SPDR S&P 500 ETF (SPY). A simulator opens and closes positions based on those predictions and keeps a ledger.

A held-out window covering 2024-01 through 2025-06 was set aside before training and may be read at most three times over the project's lifetime, enforced by a filesystem guard and a commit-message hook.

02 — What it found

The model beats the baseline on log-loss, the standard measure of how much probability a model puts on the correct next bucket. Across five seeds the best configuration reaches 3.180 against a linear baseline at 3.333. Every seed beats linear.

The gain lives in the shape of the output distribution, not the mean. Log-loss falls from 3.333 to 3.180 while the mean prediction stays within a millionth of zero. The transformer has narrowed its bet on which bucket the return will land in.

03 — Methodology
The transformer has narrowed its bet on which bucket the return will land in.

The project runs under Signal-Driven Development. Every code path emits a typed event against the locked vocabulary at signals/0.7.json, and a strict emitter checks each call as it is made. Tasks begin as sprint cards; each card declares what it will do and what events it will produce.

Log-loss rewards a good probability on the right bucket. A model can improve it by moving probability mass around inside the distribution without moving the distribution's center. Bucket and direction are separate facts about a return.