Optimal Transport Methods in Finance
Optimal transport (OT) measures the cost of transforming one probability distribution into another. Unlike a comparison of means or pointwise densities, it accounts for the geometry of the space: moving probability mass from a 1% return to 2% is cheaper than moving it from 1% to -20%. That makes Wasserstein distances useful for distribution shift, scenario design, and robust optimization.
The financial caveat is fundamental. Geometry is chosen, not discovered. A distance over raw returns, standardized returns, factor exposures, or implied-volatility surfaces answers different questions. An OT calculation can be numerically precise while economically irrelevant if its ground metric is poorly specified.
The transport problem
For discrete empirical distributions with masses a and b, and cost matrix C_ij, OT solves:
min_P sum_(i,j) P_ij C_ij
subject to P 1 = a, P' 1 = b, P_ij >= 0
P is a coupling describing how mass moves. With a cost ||xi-yj||^p, the resulting Wasserstein distance has units of the underlying feature. The 1-Wasserstein distance on daily returns is interpretable in return units; on a mixed vector of return, volume, and volatility it is meaningless until features are scaled.
| Finance task | Distribution support | Ground metric choice |
|---|---|---|
| Regime detection | rolling return vectors | volatility-normalized returns |
| Cross-market comparison | factor-return distributions | factor covariance geometry |
| Scenario generation | historical paths | path distance with timing weights |
| Robust allocation | return distribution | portfolio loss distance |
Entropic regularization and Sinkhorn
Exact OT can be costly for large samples. Entropic regularization adds epsilon * sum Pij(log(Pij)-1), yielding a smooth problem solved efficiently by Sinkhorn iterations. The trade-off is bias: large epsilon makes a transport plan diffuse and can hide tail differences.
import numpy as np
import ot # POT: Python Optimal Transport
def wasserstein_shift(reference, current):
x = reference.reshape(-1, 1)
y = current.reshape(-1, 1)
a = np.full(len(x), 1 / len(x))
b = np.full(len(y), 1 / len(y))
cost = ot.dist(x, y, metric="sqeuclidean")
return ot.sinkhorn2(a, b, cost, reg=1e-4)
This sketch requires predeclared windows and normalization. It should also be tested for convergence across reg; a single number without such sensitivity analysis is not a reliable regime feature.
Distribution shift as a research signal
An expanding training set assumes that old and new examples remain comparable. OT can quantify a shift between the feature distribution seen in training and the current distribution. If distance rises, a model might be downweighted, retrained, or routed to conservative risk limits.
That policy needs a threshold derived from history. Compute distances among adjacent historical windows, stratified by volatility regime and sample size. Otherwise a threshold will merely flag ordinary volatility clustering. Include missingness, liquidity, and calendar composition: a shift caused by a new universe constituent may not require the same action as a shift in returns.
| High OT distance with | Likely interpretation | Possible control |
|---|---|---|
| stable volatility | feature composition shift | inspect data pipeline |
| broad loss of calibration | covariate shift | downweight forecasts |
| tail movement | stress regime | widen limits and scenarios |
| one asset only | idiosyncratic event | isolate rather than retrain |
Do not call transport distance a causal metric. It reports distributional difference, not why it occurred. Pair it with the design principles in causal inference for trading signals before assigning an economic mechanism.
Wasserstein-robust portfolio optimization
Distributionally robust optimization considers all distributions within a Wasserstein radius of the empirical distribution. Instead of maximizing estimated expected return alone, it chooses weights that remain acceptable under plausible transport perturbations. The radius is a risk budget for estimation error.
The radius should not be tuned to maximize historical Sharpe. Select it from a coverage or stress objective, ideally using an earlier validation period. Robust allocations may look conservative because they penalize concentration in poorly sampled tails; that is their intended behavior, not necessarily a flaw.
Path-dependent transport
Terminal-return distributions ignore sequence. Two scenarios with the same endpoint can impose radically different drawdowns and margin calls. For path-dependent trading, use a path metric, nested distance, or causal transport constraint that prevents the coupling from using future information. These objects are more expensive and harder to estimate, but they better align with liquidation, barrier, and execution problems.
Validate any generated scenarios against constraints that matter operationally: no-arbitrage where relevant, realized drawdown shapes, cross-asset correlation, and liquidity behavior. Sampling synthetic paths that preserve only marginal distributions can create impossible joint states.
Key takeaways
- Optimal transport compares distributions using an explicit, economically chosen movement cost.
- Feature scaling and the ground metric determine what a Wasserstein distance means.
- Sinkhorn regularization improves speed but needs bias and convergence checks.
- Use OT for shift monitoring and robust scenarios alongside chronological validation and risk controls.
