Unwinding Stochastic Order Flow: When to Warehouse Trades

Marcel Nutz, Kevin Webster, Long ZhaoMathematical 2023 · arXiv

Abstract

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.

Introduction

In modern finance, large institutions utilize a Central Risk Book (CRB) to aggregate trades from various internal desks. Unlike traditional "optimal execution" problems where a trader manages a fixed, known block of shares, a CRB faces stochastic in-flow. Orders arrive randomly throughout the trading day, and their total volume is unknown a priori.

The desk faces a fundamental trade-off between Warehousing and Externalizing. By warehousing an order, the desk holds the risk, hoping for a future offsetting client order to "net out" the position (internalization). Conversely, externalizing involves immediate trading in the public market, incurring transaction costs such as the bid-ask spread and price impact. This paper derives an optimal trading speed that minimizes these costs while ensuring a flat position by the end of the trading horizon.

Methodology

The problem is framed as a Linear-Quadratic (LQ) stochastic control problem. The model incorporates:

  • Price Impact: A generalized Obizhaeva–Wang (OW) model where trades create a price dislocation that decays exponentially (resilience).
  • Spread Costs: Instantaneous costs modeled as a quadratic penalty on trading speed.
  • Feedback Control: The optimal trading speed $q_t$ is derived as a linear combination of the current inventory, the current impact state, and the history of client orders (cumulative in-flow).

The authors provide semi-closed form solutions using Riccati Ordinary Differential Equations (ODEs), ensuring the strategy is computationally efficient for real-time implementation.

Dynamics of Optimal Execution

The strategy's performance is highly dependent on the statistical properties of the incoming flow. The model captures the continuum between passive internalizers and aggressive externalizers, adjusting trading behavior based on the realization of random order flow.

Simulated time series of in-flow, out-flow, and inventory under the optimal strategy.

As shown in the simulations above, the desk adjusts its out-flow (market trading) in response to the stochastic in-flow to keep inventory within manageable bounds. The relationship between these three components defines the efficiency of the CRB.

Key Insights

Momentum vs. Mean Reversion

A critical finding is how the strategy adjusts for future flow based on its autocorrelation:

  • Martingale Flow: If future orders are equally likely to be buys or sells (truth-telling), the strategy is myopic, focusing only on the current position.
  • Momentum Flow: If buys tend to follow buys, the desk trades more aggressively early to preempt future inventory accumulation.
  • Mean-Reverting Flow: The desk warehouses more, anticipating that the flow will naturally net itself out.

Internalization Regret

The authors introduce "internalization regret," a metric measuring the fraction of market trades that were ex-post unnecessary. This occurs when the desk trades in the market only to have a subsequent client order arrive that could have netted the original position.

Empirical Validation and Results

Using LOBSTER data for S&P 500 stocks from 2019, the authors confirmed that real-world market order flow typically exhibits momentum. This validates the model's inclusion of adjustments for future flow.

Key results include:

  • Analytic Tractability: The model offers a "plug-and-play" formula accounting for time-varying liquidity.
  • Robustness: Misspecification analysis suggests it is safer to overestimate momentum than to underestimate it; trading too slowly leads to significantly higher terminal costs.
  • Volatility Sweet Spot: Expected costs are minimized at a specific level of in-flow volatility where there is enough flow to facilitate netting without necessitating excessive risk-mitigation trading.

Conclusion

This framework provides a robust mathematical foundation for CRBs to manage unpredictable order streams. By moving beyond fixed-block execution models, it offers practical strategies for modern trading desks to balance the costs of market impact against the risks of warehousing stochastic flow. Future work may extend this to include endogenous flow (where the desk influences client orders) and non-linear price impact models.

Summary updated

Abstract

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.
BibTeX
@inproceedings{nutz2023unwinding,
  author = {Marcel Nutz and Kevin Webster and Long Zhao},
  title = {{Unwinding Stochastic Order Flow: When to Warehouse Trades}},
  booktitle = {Mathematical},
  year = {2023},
}
Figure