Optimal Execution Algorithms: TWAP, VWAP & Market Impact › The Almgren-Chriss Framework
Quantitative FinanceAll chapters Optimal Execution Algorithms: TWAP, VWAP & Market Impact › The Almgren-Chriss FrameworkOne section · Sections in this chapter5 / 10 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The Almgren-Chriss model, published in 2000, provides a rigorous mathematical framework for optimal execution. It formalizes the trade-off between market impact and timing risk, deriving closed-form optimal trajectories under specific assumptions about price dynamics and market impact. This framework provided explicit mathematical solutions that practitioners could implement and analyze.
Model Setup
The framework begins by modeling the midpoint price as following arithmetic Brownian motion. This means the price evolves randomly over time, with increments that are normally distributed and independent across time periods:
where:
- : midpoint price at time
- : arithmetic volatility, representing the standard deviation of price changes per unit time
- : standard Wiener process, the mathematical representation of random price fluctuations
Note the deliberate absence of drift in this equation. The framework assumes no alpha and no expected direction of price movement. This assumption is philosophically consistent with the role of execution. The decision about what to trade and why has already been made elsewhere; it is not the execution algorithm's responsibility. The execution algorithm's job is not to predict where prices are going but to minimize the cost of getting the desired position, given that prices will fluctuate randomly during execution.
You must liquidate shares over time horizon . Let denote remaining inventory at time , with initial condition (we start with the full position) and terminal condition (we must be completely liquidated by the horizon). The trading rate is , where the negative sign reflects that inventory decreases as we trade. A positive trading rate means we are selling, and our inventory is declining.
Market Impact Model
The model incorporates both temporary and permanent market impact, as we discussed in detail in the chapter on transaction costs. These two types of impact capture different mechanisms by which trading affects prices. When trading at rate :
- Permanent impact. A fraction of impact persists permanently, moving the midpoint price for all subsequent trades and the wider market. Permanent impact reflects the information content of order flow. When you trade, the market updates its beliefs about fair value. The cumulative permanent impact is , where is the permanent impact coefficient. Every share traded permanently shifts the price by in the adverse direction.
- Temporary impact. Additional adverse price movement affects only the current trade, not future ones. This Temporary impact reflects the cost of demanding immediacy. To trade quickly, one must pay for liquidity, crossing the spread or walking up the order book. The temporary impact is , where is the temporary impact coefficient measuring the additional cost per share from trading quickly, and represents fixed costs like half the bid-ask spread that must be paid regardless of trade size.
For mathematical tractability, and because the fixed cost does not affect the optimal trajectory shape, the model typically uses linear impact functions without the fixed component:
where:
- : permanent impact function describing how price permanently shifts with trading
- : temporary impact function describing additional cost for the current trade only
- : permanent impact coefficient in dollars per share per share traded
- : temporary impact coefficient in dollars per share per share traded
- : trading rate
The linearity assumption, while stylized, captures the essential economics. Trading faster costs more due to temporary impact, and total trading permanently moves prices. The distinction between temporary and permanent impact matters because permanent impact represents a cost that cannot be avoided by changing the trading schedule, while temporary impact depends critically on how aggressively we trade.
Expected Cost and Variance
The expected execution cost consists of permanent and temporary components. For a trading trajectory with trading rate , we can derive your expected cost by integrating the impact over time. The calculation proceeds as follows:
where:
- : expected execution cost across all trading
- : initial inventory to be liquidated
- : remaining inventory at time
- : trading rate at time
- : permanent impact coefficient
- : temporary impact coefficient
- : trading horizon
This derivation reveals a fundamental insight about the structure of execution costs. The expected cost decomposes into two qualitatively different terms. The permanent impact term depends only on total shares and is completely path-independent. No matter how we schedule our trades, we will pay this cost. The factor of one-half appears because early trades suffer the full permanent impact of later trades, while later trades have already "locked in" some of that impact, creating an averaging effect. The temporary impact term depends on the execution speed and is the only component we can minimize through clever scheduling. Because it is quadratic in the trading rate, this term penalizes bursts of rapid trading and rewards smooth, steady execution.
The variance of execution cost arises from the accumulation of price risk on the held inventory. The intuition is straightforward: while we hold shares, their value fluctuates randomly. The more shares we hold and the longer we hold them, the more exposed we are to these fluctuations. If the price evolves as , the fluctuation in portfolio value is . This stochastic integral represents the cumulative random gains and losses from price movements applied to our inventory over time.
By the Itô isometry, a fundamental result in stochastic calculus, the variance of this integral can be computed by integrating the squared integrand:
where:
- : variance of execution cost
- : price volatility per unit time
- : trading horizon
- : remaining inventory at time
This variance formula captures the essence of timing risk. The unexecuted inventory remains exposed to price volatility at every moment. The variance integrates because variance is a quadratic measure. Holding twice as many shares exposes us to four times the risk. An execution schedule that maintains high inventory for a long time will have high variance, while a schedule that rapidly reduces inventory will have low variance.
Mean-Variance Optimization
With expressions for both expected cost and variance in hand, we can formulate the optimization problem. The Almgren-Chriss objective balances expected cost against variance using a risk aversion parameter :
where:
- : execution trajectory over time, the decision variable we optimize
- : risk aversion parameter, expressing how much the trader dislikes variance relative to expected cost
This mean-variance formulation should feel familiar. It is directly analogous to Markowitz portfolio optimization, which we covered in Part IV. In portfolio theory, we balance expected return against portfolio variance when choosing asset weights. Here, instead of choosing portfolio weights, we choose an execution trajectory. Instead of maximizing return while controlling risk, we minimize cost while controlling execution uncertainty. The mathematical structure is identical, which is why the Almgren-Chriss framework produces an "efficient frontier" of execution strategies just as Markowitz produces an efficient frontier of portfolios.
The risk aversion parameter is chosen by the trader and reflects their preferences. A trader with high risk aversion, large , will pay more in expected impact to achieve certainty about execution cost. A trader with low risk aversion, small , will accept uncertain outcomes in exchange for lower expected cost. There is no objectively "correct" value for ; it depends on the trader's circumstances, constraints, and risk tolerance.
The Optimal Trajectory
To derive the optimal trajectory, we must solve this optimization problem using calculus of variations. We first observe that the permanent impact term depends only on total shares , not the trading path. Since this term is the same for all feasible execution schedules, we can drop it from the optimization without affecting which trajectory is optimal.
Substituting the trading rate into the remaining cost and variance terms gives the objective functional that we seek to minimize:
where:
- : objective functional to minimize, a function of the entire trajectory
- : temporary impact coefficient
- : time derivative of inventory, equal to negative of trading rate
- : risk aversion parameter
- : volatility parameter
- : inventory at time
The integrand acts as the Lagrangian . This Lagrangian has the structure of a harmonic oscillator in classical mechanics, with a term quadratic in position (inventory) and a term quadratic in velocity (trading rate). This connection to physics is not merely coincidental; the same mathematical structure appears whenever a system must balance a position penalty against a velocity penalty.
The Euler-Lagrange equation provides the necessary condition for optimality. Any trajectory that minimizes the functional must satisfy:
where:
- : Lagrangian function
- : state variable representing inventory
- : time derivative of state variable representing trading rate
Calculating the necessary partial derivatives from our Lagrangian:
where:
- : Lagrangian function
- : inventory at time
- : first time derivative of inventory (negative of trading rate)
- : second time derivative of inventory (negative of rate of change of trading rate)
- : risk aversion parameter
- : volatility parameter
- : temporary impact coefficient
Substituting these expressions into the Euler-Lagrange equation yields the governing linear differential equation:
where:
- : second time derivative of inventory
- : risk aversion parameter
- : price volatility
- : temporary impact coefficient
- : inventory at time
This is a second-order linear ordinary differential equation with constant coefficients. The positive coefficient on indicates that solutions will be hyperbolic functions rather than trigonometric ones. Solving this ODE subject to boundary conditions (we start with full inventory) and (we must be fully liquidated by the horizon) yields a remarkable result: the optimal trajectory has a closed-form solution expressible in terms of hyperbolic functions.
Defining the risk-adjusted time constant that emerges naturally from the coefficient ratio:
where:
- : decay constant for the optimal trajectory, with units of inverse time
- : risk aversion parameter
- : price variance rate
- : temporary impact coefficient
This parameter plays a central role in the solution. It combines all the relevant model parameters into a single quantity that determines the shape of optimal execution. The numerator represents the marginal cost of holding inventory, risk aversion times variance, while the denominator represents the marginal cost of trading faster. The ratio balances these competing costs, and the square root converts this ratio into a time-scale parameter.
The optimal inventory trajectory is:
where:
- : optimal remaining inventory at time
- : initial inventory
- : trading horizon
- : risk-adjusted decay constant
- : hyperbolic sine function, defined as
This elegant formula describes exactly how inventory should decline over time. The hyperbolic sine function ensures that the trajectory satisfies both boundary conditions. At , the argument is and the ratio equals 1, giving . At , the argument is 0 and , giving .
The optimal trading rate follows as the derivative of the inventory trajectory:
where:
- : optimal trading rate
- : initial inventory
- : risk-adjusted decay constant
- : trading horizon
- : time
- : hyperbolic cosine and sine functions, where
The trading rate is highest at the beginning when is largest, and decreases over time as the remaining horizon shrinks.
The parameter determines the shape of the optimal trajectory. It balances the marginal cost of slow execution (timing risk, proportional to λ σ 2) against the marginal cost of fast execution (temporary impact, proportional to η). When κ is large as with high risk aversion or volatility and low temporary impact, optimal execution is front-loaded. When is small, execution approaches TWAP.
The optimal trajectory encompasses several intuitive limiting cases that help build understanding of what the solution means:
-
Risk-neutral trader (λ → 0): When you have no risk aversion, κ → 0 and the optimal strategy approaches TWAP. Without concern for timing risk, there is no reason to accept higher impact by trading quickly. Mathematically, as , the ratio approaches , which is the linear inventory path of TWAP.
-
Infinite risk aversion (λ → ∞): When timing risk is completely unacceptable, κ → ∞ and you liquidate immediately, accepting maximum market impact. You effectively treat any exposure to price uncertainty as infinitely costly and are willing to pay any amount in impact to eliminate it.
-
High volatility: Increasing σ increases κ, leading to faster execution. Higher volatility means greater timing risk per unit time, which justifies the acceptance of more impact to complete sooner. This makes intuitive sense: if prices are whipping around wildly, you want to finish quickly rather than remain exposed.
-
High temporary impact: Increasing η decreases κ, leading to slower execution. When impact is costly, patience pays off, as each share of accelerated trading costs more. This captures the fundamental trade-off: when impact is cheap, trade fast; when impact is expensive, trade slow.
def almgren_chriss_trajectory(
X: float, # Total shares to execute
T: float, # Time horizon
sigma: float, # Price volatility (per unit time)
eta: float, # Temporary impact coefficient
lambda_risk: float, # Risk aversion parameter
num_points: int = 100,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Compute the optimal Almgren-Chriss execution trajectory.
Returns:
t: Time points
x: Inventory at each time point
v: Trading rate at each time point
"""
# Risk-adjusted decay parameter
kappa = np.sqrt(lambda_risk * sigma**2 / eta)
# Time grid
t = np.linspace(0, T, num_points)
# Optimal inventory trajectory
if kappa * T < 1e-6: # Near risk-neutral case
x = X * (1 - t / T) # TWAP
v = np.full_like(t, X / T)
else:
x = X * np.sinh(kappa * (T - t)) / np.sinh(kappa * T)
v = X * kappa * np.cosh(kappa * (T - t)) / np.sinh(kappa * T)
return t, x, v
import numpy as np
# Parameters
X = 100_000 # shares
T = 1.0 # normalized time horizon
sigma = 0.02 # 2% volatility over horizon
eta = 2.5e-6 # temporary impact coefficient
# Different risk aversion levels
lambdas = [0.01, 0.1, 1.0, 10.0]
trajectories = {}
for lam in lambdas:
t, x, v = almgren_chriss_trajectory(X, T, sigma, eta, lam)
trajectories[lam] = {"t": t, "x": x, "v": v}

The trajectories reveal the fundamental insight of the Almgren-Chriss model. A risk-neutral trader () executes nearly linearly, resembling TWAP. As risk aversion increases, the trajectory becomes increasingly convex, with rapid early execution that slows as the position decreases. The most risk-averse trader () completes over half the execution in the first 20% of the time horizon.
Computing Expected Cost and Risk
The optimal trajectory achieves a specific expected cost and variance that depend on the model parameters. These expressions allow you to understand what you gain and give up by choosing a particular level of risk aversion. For the Almgren-Chriss solution:
where:
- : minimal expected cost achievable for the given risk aversion
- : permanent and temporary impact coefficients
- : risk-adjusted decay constant
- : total shares
- : time horizon
- : hyperbolic cosine and sine functions
The first term represents the unavoidable permanent impact cost that applies regardless of execution strategy. The second term represents the minimized temporary impact cost and depends on how aggressively we trade. A higher (more aggressive trading) increases this term because we incur more temporary impact.
The minimal variance of the execution cost is given by integrating the squared inventory trajectory:
where:
- : minimal cost variance for the given trajectory
- : price volatility
- : optimal inventory trajectory
- : trading horizon
This integral can be computed in closed form using properties of hyperbolic functions. The key observation is that faster execution, higher , reduces variance by reducing the integral of squared inventory but increases expected cost through higher temporary impact.
import numpy as np
def almgren_chriss_cost_variance(
X: float,
T: float,
sigma: float,
eta: float,
gamma: float,
lambda_risk: float,
) -> tuple[float, float]:
"""Compute expected cost and variance for the optimal trajectory."""
kappa = np.sqrt(lambda_risk * sigma**2 / eta)
if kappa * T < 1e-6:
# TWAP case
expected_cost = gamma * X**2 / 2 + eta * X**2 / T
variance = sigma**2 * X**2 * T / 3
else:
# General case
sinh_kT = np.sinh(kappa * T)
cosh_kT = np.cosh(kappa * T)
tanh_kT2 = np.tanh(kappa * T / 2)
expected_cost = gamma * X**2 / 2 + eta * X**2 * kappa * (
cosh_kT - 1
) / (T * sinh_kT)
variance = sigma**2 * X**2 * tanh_kT2 / (2 * kappa * T)
return expected_cost, variance
# Compute efficient frontier
gamma = 1e-6 # permanent impact coefficient
lambda_values = np.logspace(-3, 2, 50)
costs = []
risks = []
for lam in lambda_values:
cost, var = almgren_chriss_cost_variance(X, T, sigma, eta, gamma, lam)
costs.append(cost)
risks.append(np.sqrt(var))
costs = np.array(costs)
risks = np.array(risks)
The efficient frontier illustrates that reducing execution risk requires accepting higher expected cost. Just as in portfolio theory, there is no free lunch: faster execution eliminates timing risk but increases market impact. The trader's risk aversion determines where on this frontier they should operate.