Train an agent to allocate a stock portfolio

Buy, sell, or hold across real tickers. Press start and watch an untrained allocator become a disciplined trader.

Prices are delayed about 15 minutes, not a live trading feed. This is a practice simulation for learning, it doesn't place real trades and shouldn't be used to make real investing decisions.

Lists
AAPLApple Inc
Model Performance Rating

No training completed yet

N/A
Initial cash ($)
Symbols (3/5)
AAPLApple Inc
MSFTMicrosoft Corp
SPYS&P 500 ETF
All sessions
Loading…
AAPLLive replay

Press Start Training to see AAPL activity here.

Buy & sell bars for AAPL from the trained policy replay.

Analyst chartAAPL

After Replay finishes, this chart shows this model's Buy / Hold / Sell behaviour for AAPL.

P&L vs Starting Capital

Pending
Allocation · preview

No allocation yet.

Results
Algorithm
SAC

session policy

Portfolio value

Pending

Cash

Pending

Total return

Pending

Budget deployed

Pending

Turnover

Pending

Fees paid

Pending

Slippage paid

Pending

Avg budget used

mean deployment

RL vs baselines$ return · advantage

Finish training and replay to compare this session against Buy & Hold, MVO, XGBoost, and LSTM.

1. Configure

Buying or selling a stock isn't just yes/no — the agent also has to decide how much. That's why we default to algorithms built for fine-grained decisions (SAC, DDPG, TD3). A few others (PPO, A2C) work well here too, if you want to compare.

steps

Editable anytime before Start.

~1-2 min · good default for most portfolio runs

Untrained allocators trade randomly. Trained ones don't. Hit start to see the difference.

Same idea, real portfolios

This is the same kind of adaptive learning OptRL uses to help investment and trading teams size positions, manage risk, and rebalance portfolios — without rebuilding what you already run.

Frequently Asked Questions

Common questions about the stock trading adaptive learning demo

An interactive simulation where you can watch a reinforcement learning agent learn to buy, sell, and hold stocks, adjusting its strategy after every trading session.

A type of AI training where an agent improves its decisions through trial, error, and reward — similar to how the trader here learns better buy and sell timing the more it practices. This is also known as adaptive learning.

No. This is a paper-trading simulation using delayed market data. No real money is invested, and it isn't intended for live trading decisions.

No. Press "Start Training" and watch the results. No code, no RL background, and no trading experience required.

An untrained agent starts out trading randomly, the same way an untrained warehouse robot starts out wandering. Training is what turns random buy/sell decisions into a deliberate strategy.

You can build a watchlist of up to five tickers — for example AAPL, MSFT, and SPY — and the agent will learn to allocate a portfolio across whichever ones you choose.

The same reinforcement learning techniques shown here are used by OptRL to help investment and trading teams with position sizing, rebalancing, and risk-aware allocation in production systems.

Yes — the OptRL playground includes other simulations beyond stock trading, each showing reinforcement learning applied to a different real-world operation.

See how this applies to your portfolio.

Or try another environment in the full playground.

Explore the full playground →