Portfolio Management and Optimal Execution via Convex Optimization Enzo Busseti Stanford University April 9th, 2018
Problems portfolio management choose trades with optimization minimize risk, maximize return, control costs,... Portfolio selection, H. Markowitz, Journal of Finance, 1952 A new interpretation of information rate, J. Kelly, Bell Labs, 1956 optimal execution execute trades in markets market impact Optimal execution of portfolio transactions, R. Almgren and N. Chriss, Journal of Risk, 2001 1/39
Techniques convex optimization street fighting mathematics local conditions, global optimality Convex Optimization, S. Boyd and L. Vandenberghe, Cambridge University Press, 2004 model predictive control use forecasts updated each period optimize trajectory of actions, use first Model predictive control design: New trends and tools., A. Bemporad, IEEE Conference on Decision and Control, 2006 2/39
This talk Multi-Period Trading via Convex Optimization, S. Boyd, E. Busseti, S. Diamond, et al., Foundations & Trends in Optimization, 2017 single- (and multi-) period optimization coherent framework risk models, costs, constraints,... Risk-Constrained Kelly Gambling, E. Busseti, E. Ryu, S. Boyd, Journal of Investing, 2016 classic problem of optimal wealth growth, with modern techniques control risk of drawdown 3/39
Outline Single-period optimization Risk-constrained Kelly gambling Single-period optimization 4/39
The problem manage a portfolio of assets over multiple periods take into account market returns transaction cost holding cost constraints on trades and positions at each period, find trades as solutions of an optimization problem use up-to-date forecasts of unknown quantities goal is to achieve high (net) return, low risk Single-period optimization 5/39
Definitions n assets, long or short, plus cash time periods t = 1,..., T (e.g., trading days) portfolio weights w t R n+1 1 T w t = 1 leverage (wt ) 1:n 1 portfolio value v t R holdings w t v t dollar trades u t R n+1 normalized trades z t = u t /v t turnover is (z t ) 1:n 1 /2 asset (and cash) returns r t R n+1 Single-period optimization 6/39
Multi-period trading model enter time period t with holdings w t v t choose trades z t, execute immediately post-trade holdings (w t + z t )v t hold for period t with market returns r t next period portfolio: w t+1 v t+1 = (1 + r t ) (w t + z t )v t where is elementwise multiplication Single-period optimization 7/39
Transaction and holding cost normalized transaction cost φ trade t (z t ) (cost in dollars)/vt normalized holding cost φ hold t (z t ) self-financing condition 1 T z t + φ trade t (z t ) + φ hold t (w t + z t ) = 0 cash balance (z t ) n+1 determined by holdings v t, (w t ) 1:n, and trades (z t ) 1:n Single-period optimization 8/39
Single asset transaction cost model trading dollar amount x of some asset incurs cost ( ) x 1/2 a x + b x σ + cx V a, b, c are model parameters σ is one-period volatility V is one-period market volume standard model used in practice variations: quadratic term, piecewise-linear,... same formula for normalized trades, with V V /v t Econophysics: Master curve for price-impact function, F. Lillo, J. Farmer, and R. Mantegna, Nature, 2003 Single-period optimization 9/39
Single asset holding cost model holding x costs s(x) = s max{ x, 0} s > 0 is shorting cost rate variations: quadratic term, piecewise-linear,... same formula for portfolio weights Single-period optimization 10/39
Investment portfolio return over period t: R p t = v t+1 v t v t from the trading equation: v t+1 /v t = (1 + r t ) T (w t + z t ), use self-financing condition portfolio return in terms of weights and trades: R p t = rt T (w t + z t ) φ trade t (z t ) φ hold t (w t + z t ) Single-period optimization 11/39
Estimated portfolio return ˆR p t = ˆr t T (w t + z t ) ˆφ trade t (z t ) ˆφ hold t (w t + z t ) quantities with ˆ are estimates or forecasts (with data available at start of period t) market return forecast ˆr t is most important transaction cost estimates depend on estimates of bid-ask spread, volume, volatility holding cost is typically known Single-period optimization 12/39
Single-period optimization problem I at start of period t, choose trades z t using forecasts maximize ˆR p t, satisfy self-financing condition, trade constraints Z t, and hold constraints W t risk measure or regularizer ψ t (w t + z t ), risk aversion parameter γ risk > 0 objective is estimated risk-adjusted return maximize ˆR t p γ risk ψ t (w t + z t ) subject to z t Z t, w t + z t W t, 1 T z t + ˆφ trade t (z t ) + ˆφ hold t (w t + z t ) = 0 Single-period optimization 13/39
Single-period optimization problem II maximize ˆr t T (w t + z t ) γ risk ψ t (w t + z t ) ˆφ trade t (z t ) ˆφ hold t (w t + z t ) subject to 1 T z t = 0, z t Z t, w t + z t W t self-financing constraint can be approximated as 1 T z t = 0 (slightly over-estimates updated cash balance) a convex optimization problem, if risk, trade, and hold functions/constraints are convex Single-period optimization 14/39
Traditional quadratic risk measure ψ t (x) = x T Σ t x Σ t is an estimate of return covariance factor model risk Σ t = F t Σ f tft T + D t F t R n k is factor exposure matrix F T t w t are factor exposures Σ f t is factor covariance Dt is diagonal ( idiosyncratic ) asset returns Large-scale portfolio optimization, A. Perold, Management science, 1984 Single-period optimization 15/39
Robust risk measures worst case quadratic risk: ψ t (x) = max i=1,...,m Σ (i) are scenario or market regime covariances x T Σ (i) t x worst case over correlation changes: ψ t (x) = max x T (Σ + )x, ij κ (Σ ii Σ jj ) 1/2 κ [0, 1) is a parameter, say κ = 0.05 can express as ( ) ψ t (x) = x T Σx + κ Σ 1/2 11 x 1 + + Σnn 1/2 2 x n Single-period optimization 16/39
Return forecast risk forecast uncertainty: any return forecast of form ˆr + δ, δ ρ R n+1 is plausible; ρ i is forecast return spread for asset i worst case return forecast is min (ˆr t + δ) T (w t + z t ) = ˆr t T (w t + z t ) ρ T w t + z t δ ρ same as using nominal return forecast, with a return forecast risk term ψ t (x) = ρ T x Single-period optimization 17/39
Holding constraints long only w t + z t 0 leverage limit (w t + z t ) 1:n 1 L max capitalization limit (w t + z t ) δc t /v t weight limits w min w t + z t w max minimum cash balance (w t + z t ) n+1 c min /v t factor/sector neutrality (F t ) T i (w t + z t ) = 0 liquidation loss limit T liq ˆφ trade t ((w t + z t )/T liq ) δ concentration limit K i=1 (w t + z t ) [i] ω Single-period optimization 18/39
Trading constraints turnover limit (z t ) 1:n 1 /2 δ limit to trading volume (z t ) 1:n δ( ˆV T /v t ) transaction cost limit ˆφtrade (z t ) δ Single-period optimization 19/39
Convexity objective terms and constraints above are convex, as are many others consequences of convexity: we can (globally) solve, reliably and fast add many objective terms and constraints rapidly develop using domain-specific languages nonconvexities are easily handled, e.g., quantized positions minimum trade sizes target leverage (e.g., (x t + w t ) 1:n 1 = L tar ) Single-period optimization 20/39
Single-period optimization problem III maximize ˆr t T (w t + z t ) γ risk ψ t (w t + z t ) γ trade ˆφ trade t (z t ) γ hold ˆφ hold t (w t + z t ) subject to 1 T z t = 0, z t Z t, w t + z t W t γ risk, γ trade, γ hold 0 are hyper-parameters vary them to get what we want, e.g., ˆφ trade absolute value term discourages small trades 3/2-power term discourages large trades discourages entering illiquid positions Single-period optimization 21/39
Example S&P 500, daily realized returns and volumes, 2012 2016 initial value v 1 = $100M, weights w 1 = 1 simulated market return forecasts, correct sign 54% of the times empirical factor risk model with 15 factors volume, volatility forecasts are averages of last 10 values vary hyper-parameters γ risk, γ trade, γ hold over ranges Single-period optimization 22/39
Example: Risk-return trade-off Single-period optimization 23/39
Example: Pareto optimal frontier grid search over 410 hyper-parameter combinations Single-period optimization 24/39
Single-period optimization: conclusions organized way to parametrize trading strategies we defined a coherent framework we developed novel risk models, constraints Single-period optimization 25/39
Outline Single-period optimization Risk-constrained Kelly gambling Risk-constrained Kelly gambling 26/39
The problem maximize wealth growth in repeated bets random i.i.d. returns we revisit a classic problem standard convex optimization for finite outcomes stochastic first order method for general returns standard solution can have bad drawdown we develop a systematic way to trade off growth rate and drawdown risk Risk-constrained Kelly gambling 27/39
Model time periods t = 1, 2,... n possible bets (last one is cash) wealth w t R +, w 1 = 1 at each period, bet (same) fractions b R n of wealth 1 T b = 1, b 0 bets have random return r t R n +, i.i.d., with (r t ) n = 1 wealth changes as w t+1 = w t r T t b log w t = t 1 τ=1 log r T τ b is a random walk E log(r T b) 0 is the (wealth) growth rate Risk-constrained Kelly gambling 28/39
Kelly gambling maximize E log(r T b) subject to 1 T b = 1, b 0 a convex problem analytical solution in trivial cases standard convex optimization if outcomes are finite stochastic gradient descent for general returns can lose large amounts of wealth before eventually increasing fractional Kelly gambling A new interpretation of information rate, J. Kelly, Bell Labs, 1956 Risk-constrained Kelly gambling 29/39
Drawdown W min = inf t=1,2,... w t is (random) function of b a drawdown happens if W min is small drawdown risk constraint: problem Prob(W min < α) < β, α, β (0, 1) maximize E log(r T b) subject to 1 T b = 1, b 0, Prob(W min < α) < β, (as far as we know) non-tractable Risk-constrained Kelly gambling 30/39
Lemma: threshold crossing random walk (X i, i 1), i.i.d., with distribution measure µ X (x) assume γ(λ) = log E e λx is finite for λ [λ, λ + ] tilted distribution ν X,λ (x) = µ X (x)e λx γ(λ) S n = n i=1 X i τ = inf{t 1 S t < δ} for any n 1: Prob νx,λ (τ = n) = E e λsτ τγ(λ) I τ=n sum over n: 1 E e λsτ τγ(λ) I τ< (1) similar to the Wald s identity, see, e.g., Stochastic Processes: Theory for Applications, R. Gallager, Cambridge University Press, 2013. Risk-constrained Kelly gambling 31/39
Drawdown bound X i = log ri T b S t = t i=1 log r T b = log w t i δ = log α, so τ = inf{t 1 w t < α} λ = log β/ log α > 0 assume log E(r T b) λ = γ(λ) 0 S τ < log α and τγ(λ) 0, so from (1): which implies: 1 E e λsτ τγ(λ) I τ< > E e λ log α I τ< β > Prob(W min < α) Risk-constrained Kelly gambling 32/39
Risk-constrained Kelly gambling maximize E log(r T b) subject to 1 T b = 1, b 0 log E(r T b) λ 0, disciplined convex problem convex restriction of risk constrained problem solution satisfies Prob(W min < α) < β, for any α, β (0, 1) such that λ = log β/ log α Risk-constrained Kelly gambling 33/39
Example n = 20, K = 100 outcomes probabilities π i 0, i = 1,..., K returns r ij R ++ for i = 1,..., K and j = 1,..., n 1, uniform in [0.7, 1.3], plus some outliers α = 0.7, β = 0.1, λ = 6.456 solve problem simulate trajectories of w t for t = 1,..., T = 100 Bet E log(r T b) e λ log α Prob(W min < α) Kelly 0.062-0.398 RCK, λ = 6.456 0.043 0.100 0.071 RCK, λ = 5.500 0.047 0.141 0.099 Risk-constrained Kelly gambling 34/39
Example: CVXPY code b = Variable(n) lambd = Parameter(sign = positive ) growth = pi.t*log(r.t*b) risk = log_sum_exp(log(pi) - lambd * log(r.t*b)) <= 0 constr = [sum_entries(b) == 1, b >= 0, risk] Problem(Maximize(growth), constr).solve() Risk-constrained Kelly gambling 35/39
Example: wealth trajectories Risk-constrained Kelly gambling 36/39
Example: CDF of W min Risk-constrained Kelly gambling 37/39
Risk-constrained Kelly gambling: conclusions Kelly gambling maximizes growth, but can have large drawdown we developed a systematic way to trade off growth rate and drawdown risk convex optimization algorithms to solve the problem with general returns Risk-constrained Kelly gambling 38/39
Thank you!
Quadratic approximation I assume r T b 1, and let ρ = r 1: we get: log(r T b) = ρ T b 1 2 (ρt b) 2 + O((ρ T b) 3 ) (r T b) λ = 1 λρ T b + λ(λ + 1) (ρ T b) 2 + O((ρ T b) 3 ) 2 maximize E ρ T b 1 2 E(ρT b) 2 subject to 1 T b = 1, b 0, λ E ρ T b + λ(λ+1) 2 E(ρ T b) 2 0 quadratically constrained (convex) quadratic program equivalent to Markowitz problem with µ = E ρ, Σ = E ρρ T µµ T
Quadratic approximation II dualize the risk constraint, for some ν 0 maximize µ T b 1 2 bt Sb + ν(µ T b λ+1 2 bt Sb) subject to 1 T b = 1, b 0 rearrange and scale constants equivalent to maximize µ T b η 2 (µt b) 2 η 2 bt Σb subject to 1 T b = 1, b 0, maximize (1 ηµ T b )µ T b η 2 bt Σb subject to 1 T b = 1, b 0, (can show that µ T b 1/η)
Example: Trade-off of drawdown risk and growth rate