Online Portfolio Selection Algorithms

Online portfolio selection (OLPS) updates allocation after each return observation without fitting a stationary return model. The sequence is simple: select weights, observe returns, update. Its appeal is that regret—not prediction accuracy—is the native objective. Its limitation is equally important: financial returns are non-stationary and trading costs can dominate the small theoretical edge between algorithms.

At period t, choose bt in the long-only simplex, observe gross-relative returns xt, and receive log(bt'xt). The online learner seeks low regret against a benchmark class:

Regret_T = max_b Σ log(b'x_t) − Σ log(b_t'x_t)

The choice of comparator defines the strategy. Beating the best constant-rebalanced portfolio is not equivalent to timing the next winner.

Algorithm families

FamilyUpdate intuitionComparatorMain risk
EGmultiplicatively reward winnersCRPtrend chasing
ONScurvature-aware online Newton stepCRPunstable inversion
PAMRreverse recent relative movesmean reversioncrashes in trends
CWMRmaintain a weight distributionmean reversionsensitive hyperparameters
RMRrobust median reversion signalmean reversionslow adaptation

Exponentiated Gradient (EG) is the compact baseline. It keeps weights nonnegative and renormalizes after a multiplicative update:

b_(t+1,i) ∝ b_(t,i) exp(η x_(t,i) / (b_t'x_t))

It boosts assets that contributed to portfolio return. Passive-Aggressive Mean Reversion (PAMR) instead moves away from assets that just outperformed, subject to a target portfolio return. That reversal is a structural bet, not an optimization free lunch.

import numpy as np

def eg_update(weights, gross_return, eta=0.05, floor=1e-12):
    """Long-only Exponentiated Gradient update."""
    portfolio_gross = max(weights @ gross_return, floor)
    proposal = weights * np.exp(eta * gross_return / portfolio_gross)
    return proposal / proposal.sum()

def turnover_limited(target, current, max_turnover):
    trade = target - current
    scale = min(1.0, max_turnover / max(np.abs(trade).sum(), 1e-12))
    return current + scale * trade

Training protocol is the strategy

OLPS has little offline fitting, but it still has parameters: learning rate, window length, expert universe, and rebalance frequency. Select these using walk-forward testing, then freeze them. Choosing the best η on the full history is ordinary look-ahead bias disguised as online learning.

Use total-return-adjusted prices, align market holidays, and decide whether the signal is available before the next trade. The return applied at t must be earned after the weights were fixed. Corporate-action errors can create a much larger false edge than the differences among algorithms.

Costs change the objective

The frictionless wealth recursion is:

W_t = W_(t−1) (b_t'x_t)

With proportional costs c and pre-trade drifted weights b̃_t, use:

W_t = W_(t−1) (1 − c ||b_t − b̃_t||₁/2) (b_t'x_t)

This immediately penalizes aggressive daily updates. A practical implementation applies a no-trade band, caps turnover, and trades only liquid sleeves. See cost-aware portfolio optimization for models beyond a flat spread.

DiagnosticWhy it matters
net log wealthmatches OLPS objective
average turnoverproxy for implementation burden
worst rolling drawdownreveals regime failure
stability across universeschecks data-mined asset selection
exposure concentrationprevents accidental single-name bets

Combining learning with risk controls

Do not let an online update bypass the portfolio risk layer. Project proposed weights onto position limits, sector constraints, and a volatility target. If the universe is large, reduce it to diversified sleeves first using hierarchical risk parity or a shrinkage risk model. Online learning can then allocate among sleeves rather than repeatedly trading hundreds of noisy names.

OLPS is strongest where the comparative advantage is clear: a small, liquid universe, reliable daily data, meaningful cross-sectional dispersion, and low costs. It is weak when an algorithm assumes mean reversion in a market with persistent trends or when leverage is used to magnify an unvalidated backtest.

Key takeaways

  • OLPS optimizes sequential wealth or regret, not next-period forecasts.
  • EG and mean-reversion rules embody different market hypotheses.
  • Walk-forward parameter selection and correct trade timing remain essential.
  • Net log wealth, turnover caps, and risk projections matter more than marginal regret bounds.
#online learning #portfolio selection #machine learning #online convex optimization #trading