  We study how to unwind stochastic order flow with minimal transaction costs.
Stochastic order flow arises, e.g., in the central risk book (CRB), a
centralized trading desk that aggregates order flows within a financial
institution. The desk can warehouse in-flow orders, ideally netting them
against subsequent opposite orders (internalization), or route them to the
market (externalization) and incur costs related to price impact and bid-ask
spread. We model and solve this problem for a general class of in-flow
processes, enabling us to study in detail how in-flow characteristics affect
optimal strategy and core trading metrics. Our model allows for an analytic
solution in semi-closed form and is readily implementable numerically. Compared
with a standard execution problem where the order size is known upfront, the
unwind strategy exhibits an additive adjustment for projected future in-flows.
Its sign depends on the autocorrelation of orders; only truth-telling
(martingale) flow is unwound myopically. In addition to analytic results, we
present extensive simulations for different use cases and regimes, and
introduce new metrics of practical interest.
