← All experiments

Experiment 001 · Adaptive Bandit

Explore, Exploit, Invest

Can a simple learning rule beat buy-and-hold? This frozen backtest compares a weekly adaptive strategy with ten single-stock investments and a simple portfolio that starts equally across all ten, then does nothing.

Frozen data snapshot through loading…

One-year backtest

Can recent winners keep winning?

Each line starts with $1,000. Ten buy one stock, one splits the money equally and never trades, and the adaptive portfolio learns and reallocates every week.

Starting amount$1,000 each
Leader today...
Weekly decisions...

Comparing the adaptive strategy with the equal-weight benchmark…

Explore ↔ exploit

Where the adaptive dollar went

Every vertical slice totals 100%. Wider bands represent larger allocations.

Final snapshot allocation

Where the adaptive model finished

Loading the final weekly decision…

Uses adjusted prices, fractional shares, and weekly close-to-close signals. Assumes rebalancing at the weekly closing price with no fees, taxes, spread, or slippage. This experiment is for education and is not investment advice.

the short version

Findings and Next Steps

What worked

A small adaptive edge

The bandit finished at $1,354.06 versus $1,332.09 for the untouched equal-weight portfolio. Reallocating added $21.97, or 2.20 percentage points, in this one-year window.

What fell short

It did not find the best stocks

Several single-stock holds finished well ahead of the bandit. The strategy reduced concentration risk, but this result is not evidence that it can reliably identify winners.

What I learned

The benchmark changes the story

Beating an equal ten-stock hold is more informative than beating a few hand-picked stocks, but the edge is small enough that realistic trading costs and timing could erase it.

What I would try next

  • Execute at the next tradable price and include spread, taxes, and slippage.
  • Repeat the test across many non-overlapping one-year periods.
  • Compare weekly adaptation with a periodically rebalanced equal-weight portfolio.

the rule, without the jargon

How the adaptive strategy learns

The model is intentionally small enough to inspect. It never predicts a price; it only changes how much capital each stock receives based on recent evidence.

  1. 01

    Begin equally

    The first $1,000 is split ten ways, with 10% in each company across ten different parts of the economy.

  2. 02

    Observe one week

    After the final trading session of the week, the model measures each stock’s adjusted close-to-close return.

  3. 03

    Update the score

    Each score is 50% its previous value and 50% the newest weekly return. That remembers momentum without letting one week erase the past.

  4. 04

    Exploit, but keep exploring

    Higher scores receive more money the following week. Every stock keeps at least 3%, and no stock can exceed 30%.

Decision log

Recent weekly allocations

Weights shown are the allocations selected after that week’s returns.

Week endingPortfolioLargest allocationWeekly winnerTurnover
Loading weekly decisions…

for those who want the symbols

The Math Zone

Everything the model does can be written in six equations. Let i identify one of the ten stocks, w a trading week, and t a trading day.

01 · baselines

Buy-and-hold values

Bi,t = 1000 · Pi,tPi,0
Et = 11010i=1 Bi,t

The single-stock lines put all $1,000 into one company. The equal-weight benchmark puts $100 into each company on day zero and never rebalances.

02 · reward

Weekly return

ri,w = Pi,end(w)Pi,start(w) − 1

The reward is simply that stock’s adjusted percentage gain or loss during the week.

03 · memory

Learned score

qi,w = 0.50qi,w−1 + 0.50ri,w

Half of the score comes from accumulated memory and half from the newest observation.

04 · exploitation

Softmax preference

pi,w = eqi,w/τ10j=1 eqj,w/τ

With temperature τ = 0.04, stronger scores receive exponentially more preference without becoming an automatic all-in bet.

05 · exploration

Mixed target weight

i,w = γ10 + (1 − γ)pi,w

We set γ = 0.30. Thirty percent is spread equally, guaranteeing a 3% exploratory position in every stock.

06 · guardrail + value

Portfolio update

wi,w = CapNormalize(i,w, 0.30)
Vt = 10i=1 ni,tPi,t

Any position above 30% is capped and its excess redistributed. Portfolio value is the sum of shares times adjusted prices.