concept

Optimal Execution

How do you sell a large position without moving the price against yourself?

Suppose you need to sell 10,000 units of something. You could sell it all at once — but a market order that large eats through every resting buy order in the The Limit Order Book, and you'll fill at progressively worse prices. So you split it into smaller child orders spread over time.

Now you have a new problem: how do you schedule them? Sell too aggressively and you pay Market Impact. Sell too slowly and you're exposed to the price drifting away from you while you wait. That tension — impact against risk — is the whole subject.

The classical answers

Bertsimas and Lo (1998) solved it with stochastic dynamic programming, and found something instructive: the naive strategy of selling equal amounts at equal intervals (a TWAP schedule) is optimal only under a narrow set of assumptions — linear permanent impact, random-walk prices. Change the assumptions and the optimal schedule changes shape.

Almgren and Chriss (2001) reframed it as a mean-variance trade-off, exactly parallel to Markowitz portfolio theory. Rather than one optimal strategy there's an efficient frontier of them: for any level of execution risk you're willing to bear, there's a schedule that minimizes expected cost. Where you sit on that frontier is a statement about your risk appetite, not about mathematics.

I built an interactive implementation of this model, because the frontier is much easier to understand when you can drag a risk-aversion slider and watch the trade schedule reshape itself.

Why reinforcement learning

Both classical results depend on assuming a functional form for market impact. Real books don't cooperate. Learning the policy directly from market data sidesteps the assumption — at the cost of needing a lot of data and a very careful evaluation protocol.

The metric everyone reports is Implementation Shortfall.