Back to Blog
tradingtradinglstmtime-seriesquantdeep-learning

I Built an AI That Watches 103 Stocks Simultaneously — Here's What It Found

Overview of the LDTM v2 trading system: LSTM-based temporal models, walk-forward validation, and live deployment architecture.

January 15, 2026·14 min read

I Built an AI That Watches 103 Stocks Simultaneously — Here's What It Found

Published: April 2026 | System: LDTM v2 on NVIDIA GB10 DGX


When most people think about AI and stock markets, they imagine a Wall Street supercomputer executing trades in microseconds. What I built is something different — a system that wakes up every evening, quietly reads twenty years of price history for 103 of the most actively traded stocks in the world, and writes three predictions for each one: where the stock will close tomorrow, where it will close next Monday, and where it will close in about a month.

No news feeds. No analyst reports. No sentiment models. Just price action, volume, and momentum — the same signals a seasoned trader watches on a chart, compressed into mathematics.

This is the story of building that system, what happened when it ran across the full NASDAQ-100 universe on April 22, 2026, and what the numbers say about where these markets might be headed.


The Core Idea: Teaching a Machine to Read a Chart

A stock chart is a time series — a sequence of numbers where each number is related to the ones before it. Prices trend. They mean-revert. They exhibit seasonality around earnings quarters. They carry momentum that persists for days or weeks before reversing.

The mathematical tool designed precisely for sequences with long-range memory is the Long Short-Term Memory network (LSTM), a type of recurrent neural network introduced by Sepp Hochreiter and Jürgen Schmidhuber in 1997. Nearly three decades later, it remains one of the best architectures for financial time series — not because it's fashionable, but because it works.

The key insight in an LSTM is the cell state: a kind of conveyor belt that runs through the entire sequence, carrying information forward across time. At each step, three "gates" decide what to remember, what to forget, and what to output:

Forget gate:  f_t = σ(W_f · [h_{t-1}, x_t] + b_f)
Input gate:   i_t = σ(W_i · [h_{t-1}, x_t] + b_i)
Output gate:  o_t = σ(W_o · [h_{t-1}, x_t] + b_o)

New memory:   g_t = tanh(W_g · [h_{t-1}, x_t] + b_g)
Cell update:  C_t = f_t ⊙ C_{t-1} + i_t ⊙ g_t
Hidden state: h_t = o_t ⊙ tanh(C_t)

Where σ is the sigmoid function (squashes values to 0–1, acting as a gate) and ⊙ is element-wise multiplication. The forget gate decides how much of yesterday's memory to carry forward. The input gate decides how much of today's new information to write into memory. This is why LSTMs can learn that an earnings quarter happened 63 days ago and is still relevant — the signal persists in the cell state until the forget gate decides to let it go.


What Goes In: 11 Features Per Trading Day

For each ticker, the model receives a 30-day sliding window with 11 features computed from raw OHLCV (Open, High, Low, Close, Volume) data:

Feature Formula Why It Matters
Open, High, Low, Close, Volume Raw The fundamental price record
Daily return (C_t − C_{t-1}) / C_{t-1} Momentum signal, stationary
5-day return (C_t − C_{t-5}) / C_{t-5} Short-term trend
RSI-14 14-period relative strength index Overbought/oversold
MA-5 5-day moving average Immediate trend
MA-10 10-day moving average Medium trend
MA-20 20-day moving average Monthly trend baseline

The 30-day window (six trading weeks) sits roughly in the middle of a quarterly earnings cycle (~63 trading days). It captures the price behavior that follows the most recent earnings report — the drift, the consolidation, the momentum build or fade — without reaching so far back that the previous quarter's reaction bleeds in and confuses the picture.

The Normalization Problem — and How We Solved It

Here's a challenge that trips up many financial ML systems: Apple in 2005 traded around $40. Apple in 2025 trades around $220. If you train a neural network on this raw data, it learns that "a price of $40 means undervalued" — which is complete nonsense. A naive global normalization (scale the whole dataset to 0–1) just transfers the problem; the model now learns that 0.2 on a global scale means something specific to 2005.

The solution is per-window normalization. Each individual 30-day window is scaled by its own minimum and maximum:

x_normalized = (x - window_min) / (window_max - window_min)

The model never sees absolute prices. It only ever sees prices relative to their own recent range. A stock at the top of its 30-day range looks the same whether it's $40 or $220. The model learns patterns of relative movement, not absolute price levels.

When generating a prediction, we invert this transform to get a dollar figure:

P_predicted = norm_pred × (window_max - window_min) + window_min

This means the model is always asking: "Given the shape of this price movement over the last 30 days, where is this stock likely to be relative to that range in N days?"


The Architecture: One Model Per Stock

Rather than training a single model on all 103 stocks simultaneously, LDTM trains a completely separate model for each ticker. This is a deliberate design choice:

Why per-ticker models? NVIDIA and a regional bank move differently. NVIDIA's price is driven by GPU order cycles and AI capex spending. A bank's price follows interest rate expectations and loan default rates. Trying to capture both in one model means the model learns a confused average of two very different systems.

Per-ticker models allow each stock's unique behavioral signature to be captured. NVDA's model learns that momentum tends to extend for several days after a gap-up. A utility stock's model learns mean-reversion patterns. Each model is a specialist.

The architecture is:

Input: (32 × 30 × 11)     — batch × time_steps × features
LSTM Layer 1: hidden=128
LSTM Layer 2: hidden=128   — 2 layers with dropout=0.2
               ↓
         FC + Tanh          — shared backbone
         /    |    \
     Head1  Head2  Head3   — 3 independent prediction heads
  next_day  next_mon  1_month

227,394 parameters per model. Tiny by modern standards — a single Mistral-7B parameter takes more memory than the entire LDTM model. This is by design: with only ~5,000 training samples per ticker (20 years of daily data), a larger model would overfit immediately.

Training uses:

  • AdamW optimizer with weight decay (L2 regularization baked in)
  • CosineAnnealingLR — learning rate decays smoothly from 0.001 to 0.0001 over training
  • AMP (Automatic Mixed Precision) — FP16 compute where hardware allows
  • Early stopping with patience=10 epochs, restoring the best weights found

Running 103 Models in 20 Minutes

The DGX host runs an NVIDIA GB10 with 128GB of unified memory. On April 22, 2026, the system ran all 103 training+inference jobs in parallel.

Here's the trick: each job runs in its own isolated Docker container. A custom Python orchestrator (orchestrate.py) manages a pool of GPU slots, dispatching jobs as slots become free — like a job queue but GPU-aware.

GPU 0 (GB10, 128GB):
  Triton/Mistral-7B FP8:    ~39 GB  (always resident)
  Desktop (Xorg/GNOME):     ~570 MB
  Available for LDTM:       ~88 GB

Per LDTM container:
  CUDA context overhead:    ~250 MB  (fixed, unavoidable)
  Model weights:            ~1 MB
  Batch buffers + optimizer:~3 MB
  Python/PyTorch runtime:   ~55 MB
  Total:                    ~310 MB

16 parallel slots × 310 MB = 4.96 GB used
GPU-Util during run:        ~90%
Wall clock (103 tickers):   ~20 minutes

206/206 jobs succeeded. Zero failures, zero retries.

Training time varied significantly by ticker history depth:

Category Count Avg Time Example
Ultra-fast (< 10s) 3 ~4.7s FER, GEHC, CSGP — recent IPOs, limited history
Fast (10–30s) 38 ~23s GOOG, EA, SNPS
Medium (30–60s) 40 ~44s NVDA, TSLA
Slow (60–130s) 22 ~85s MSTR, TRI, ADP

The ultra-fast tickers are interesting: they exit early because their limited training data (< 3 years since listing) causes rapid validation loss overfitting — the model has nothing left to learn from.


The Findings: What the Model Thinks Is About to Happen

After training, each model ran inference on the most recent 30 days of price data, producing three predictions. Here's what the system saw in the market as of April 22, 2026 — all figures verified directly from the database.

The Standout Signal: AMD

AMD: $284.49 → $315.00 (+10.7% in one month)

AMD was the strongest predicted mover in the entire universe with an implied one-month return of +10.7%. The model sees momentum continuing after AMD's recent strength ($258 on April 15 to $284 by April 21). All three prediction heads agree directionally — next day, next week, and next month all point up — making this the highest-conviction single-name call in the run.

The Macro Signal: TQQQ/SQQQ Confirmation

One of the most meaningful signals in the dataset is the prediction pair for TQQQ and SQQQ — the 3× leveraged long and short NASDAQ-100 ETFs respectively.

  • TQQQ (3× Long NDX): $57.40 → $61.16 (+6.6%) — model predicts upside continuation
  • SQQQ (3× Short NDX): $57.59 → $53.15 (−7.7%) — model predicts price decline (NDX goes UP)

These are independent models trained on completely separate historical datasets. They both arrive at the same directional call for the NASDAQ-100. When a leveraged long and its inverse both point the same way, the signal is robust — it's not a single model hallucinating a pattern.

Interpretation: Both models are expressing the same underlying view — NDX momentum is pointing upward over the next 3–4 weeks.

Mega-Cap Consensus

The large-cap technology cluster showed a broadly bullish signal, with one notable exception:

Ticker Company Close (Apr 21) 1-Month Pred Implied Return
INTU Intuit $404.85 $443.29 +9.5%
META Meta Platforms $668.84 $698.63 +4.5%
TSLA Tesla $386.42 $403.95 +4.5%
NVDA NVIDIA $199.88 $208.06 +4.1%
MSFT Microsoft $424.16 $440.33 +3.8%
GOOG Alphabet $330.47 $343.06 +3.8%
AAPL Apple $266.17 $275.05 +3.3%
AMZN Amazon $249.91 $256.56 +2.7%
CSCO Cisco $89.70 $88.88 −0.9%

INTU stands out as the second-strongest signal in the entire run at +9.5%. CSCO is the outlier — the only mega-cap the model sees going sideways-to-down, suggesting its recovery momentum has exhausted. When seven of eight major technology names align upward, the model is making an implicit sector-level call: the NDX regime is bullish.

The Bearish Outlier: Freight

Two freight/transportation companies stood out as the only notable bearish signals in an otherwise broadly positive prediction set:

  • ODFL (Old Dominion Freight): $224.42 → $174.35 (−22.3% implied one-month return)
  • CSX (CSX Corporation): $43.37 → $42.75 (−1.4% implied one-month return)

ODFL's signal is the strongest bearish call in the entire 103-ticker universe — a −22.3% predicted move in 21 trading days. Freight companies are a leading economic indicator: when shipping volumes slow, economic activity typically follows 2–3 months later. The model has seen this price pattern before and is treating it as a regime warning.

CSX's signal is milder but directionally aligned. Two independent freight models pointing down simultaneously is harder to dismiss than one.

This is not a recession call — it's a sector-level caution flag worth monitoring over the next 30 days.


What the Model Doesn't Know (And What To Watch For)

Being honest about limitations is as important as reporting the findings.

The model knows nothing about the news. It has no awareness of earnings announcements, Fed decisions, geopolitical events, or executive departures. If Apple announces a disappointing iPhone cycle tomorrow, the model's $275 one-month prediction becomes worthless instantly. The model is a pattern-completion engine, not an oracle.

Predictions are verified against actual closing prices. Before publishing any finding, every number in this post was cross-checked against the database. The model's predictions for AMD ($282 next-day against an actual close of $284.49), NVDA ($198 against $199.88), and AAPL ($268.55 against $266.17) are all within normal prediction error bands, confirming the model is operating on clean data.

Prediction accuracy is being tracked. The system writes each day's predictions to a ldtm_daily_snapshots database table. Starting tomorrow (April 23, 2026), the system will automatically back-fill actual closing prices and compute:

  • Direction accuracy (did the model get UP/DOWN right?)
  • Mean absolute percentage error
  • A 30-day rolling accuracy leaderboard across all 103 tickers

After 30 days of tracking, we'll know which tickers the model predicts well and which ones it doesn't. Some stocks will consistently achieve 60%+ directional accuracy. Others — particularly those with large gap risk around earnings — will be closer to 50%.


The Infrastructure: How It Actually Runs

The system is designed to be fully autonomous. Every trading day at 6:15 PM:

  1. Ingestion (5 min): Pull the day's closing prices from Interactive Brokers TWS into PostgreSQL
  2. Inference (2 min): Run all 103 LSTM forward passes, write predictions to ldtm_run_log
  3. Snapshot write (30s): Upsert today's predictions into ldtm_daily_snapshots with directional labels
  4. Fill-back (30s): Update prior predictions where actual closes are now available

Once a month (first Sunday at 1 AM), the system runs a full retrain of all 103 models against the latest 20 years of data. Weekly, it runs a "canary retrain" on NVDA, TQQQ, and AAPL to detect if a macro regime shift is making the models stale before the full monthly retrain catches it.

An LLM query interface allows natural language questions against the predictions and historical context. Running locally on a Mistral-7B model (already deployed on the same GPU server for other purposes), you can ask:

"Which semis have the strongest 1-month outlook and how does that compare to 30-day accuracy?"

And the model assembles a structured context from the database — predictions, accuracy metrics, last retrain date, recent news headlines — and generates a narrative response. No cloud API required; the whole thing runs on the same DGX server.


What's Next: Making It Better

The current model achieves validation losses around 0.578 on average. Here's what the path to improvement looks like:

Near-term (this month): Upgrade to hidden_size=256 and num_layers=3. This increases parameters from 227K to 787K per ticker — still tiny — but more importantly, it properly utilizes the GPU's tensor core hardware for FP16 computation. Expected improvement: ~10% reduction in validation loss. Cost: all 103 checkpoints need to be retrained.

Medium-term (3–6 months): Ensemble the LSTM predictions with the existing TQQQ Random Forest signal. The RF model provides regime classification (BUY/HOLD/SHORT probability), while LDTM provides price magnitude estimates. A weighted ensemble based on each model's recent 30-day accuracy would be more robust than either model alone.

Long-term (6–12 months): Replace the LSTM backbone with a Temporal Fusion Transformer (TFT) — an architecture designed specifically for multi-horizon forecasting with mixed continuous and categorical inputs. This would allow incorporating earnings dates, VIX regime signals, and VXN (NASDAQ volatility) as categorical/contextual variables. Expected validation loss improvement: 30–40% relative.

The current system already ingests VXN. The news headlines table exists and is populated. The infrastructure is in place for this upgrade; what's needed is the model architecture change.


Closing Thoughts

Building this system took more architectural decisions than model decisions. The interesting problems weren't "which neural network layer to use" — they were:

  • How do you normalize prices across 20 years without leaking information?
  • How do you run 103 isolated training jobs without them competing for GPU memory?
  • How do you track prediction accuracy automatically so you know when the model is degrading?
  • How do you build infrastructure that keeps running when you're not watching it?

The LSTM is mature, well-understood technology. What's less common is deploying it at this scale, with this level of operational rigor, on consumer-accessible hardware. An NVIDIA GB10 with 128GB unified memory costs roughly what a mid-range workstation cost five years ago. The entire stack runs on a single machine consuming about 400W.

The April 22, 2026 run produced 309 price predictions across 103 tickers in 20 minutes, with zero failures, while a 7-billion parameter language model continued serving requests on the same GPU. The software engineering got out of the way of the research.

What the model found in those 309 predictions: a broadly bullish NASDAQ-100 regime, an AMD breakout setup, a freight sector warning signal, and — most importantly — a consistent double confirmation from the TQQQ/SQQQ pair that the index is in a momentum-up phase.

Whether those predictions are right will be determined over the next 30 trading days, automatically, in a database row somewhere, written by a scheduler that runs whether or not anyone is watching.


Technical details: LDTM v2 architecture reference available in docs/LDTM-v2-architecture-implementation-2026-04-21.md. Operations runbook in docs/LDTM-v2-runbook-2026-04-21.md. Performance analysis and GPU optimization guide in docs/LDTM-v2-performance-analysis-2026-04-21.md.

System hardware: NVIDIA GB10 DGX (128GB unified memory). Model: 2-layer LSTM, hidden_size=128, 3 prediction heads, 227K parameters, per-window min-max normalization, AdamW + CosineAnnealingLR + AMP. Training data: Interactive Brokers TWS daily OHLCV, 20 years, 103 NDX-100 tickers.