The quoting workbench
The workbench solves a finite-horizon inventory-control problem, then tests its quotes against two benchmarks on the same simulated market paths: a fixed spread that quotes both sides 1/k + f = 0.26 from the mid, a full spread of 0.52, and a zero-flow skew that uses the control's own quote rule with order flow switched off. The hostile-flow setting is where the model's assumptions start to fail, and it is the most useful run to look at.
The exchange and every price and order on it are made up. Nothing here trades, connects to a market or reports a real result.
sup E[ XT + qTST − c|qT| − φ∫qt²dt ]The objective: terminal profit, less the cost of liquidating what is left and a penalty for the time spent carrying inventory. φ = ½γσ².
Runs in a background worker in your browser once JavaScript is on.
Distribution of terminal profit
Terminal net P&L in simulated price units, after fees and liquidation.
Scroll charts horizontally on a small screen to inspect labels. Summary statistics and the full JSON remain available below.
Inventory controlFixed spread
| Policy | Mean P&L | P&L SD | 5th percentile | Lower-tail mean | Loss frequency | RMS inventory |
|---|
Quotes by inventory level
Initial bid and ask distances from the mid. Inventory limits withdraw the risk-increasing quote. The curves are the solved policy.
One path, chosen in advance
Path 0, fixed in advance. Green: control. Grey: fixed spread. Same prices and candidate orders; different inventory decisions.
Quotes and fills on path 0
The control policy on the same path: where it quoted, and where orders reached it.
Dark line: mid after each event. Green steps: bid. Brown steps: ask. Up triangles: fills at the bid, where the desk buys. Down triangles: fills at the ask, where it sells. A gap in a quote line is a quote withdrawn at the inventory limit.
The value function at three times
Solved h(t, q) at the start, the midpoint and the end, with the zero-flow closed form dotted.
Each line is the solved value h(t, q) across inventory at one time; dotted lines are −c|q| − φq²(T − t), the exact value when no orders arrive. The gap between them is what quoting is worth.
Where the money came from
Mean breakdown across all paths. Spread capture + inventory repricing − trading fees − liquidation = net P&L.
The same policy in nine stressed markets
Nine stress settings, up to 64 paired paths each. The policy and both benchmarks are solved once and kept fixed. Each cell shows the control's mean P&L minus the fixed spread's, then minus the zero-flow skew's, on the same paths, with the control's loss frequency.
| Adverse jump / Volatility | 0.5× | 1.0× | 2.0× |
|---|
Method and limits: equations, execution assumptions and lineage
The numerical problem
V = x + qs + h(t,q), q ∈ {−Q,…,Q}, with Q = 8 by default. With τ = T−t, solve:
∂h/∂τ = −φq² + Σ maxδ≥0.01 A e−kδ[δ−f+h(q±1)−h(q)]
h(0,q) = −c|q|
δ* = max(0.01, 1/k + f + h(q) − h(q±1))Transitions past the inventory limit are left out. Fourth-order Runge-Kutta with 600 time steps by default and linear interpolation in time. The run solves again with twice the steps (1,200 by default) and reports the largest quote difference over all inventory states at the start, midpoint and end: a check at those points only. A run whose quotes move by more than 0.01 price units under that halving has not settled, and it is refused with that reason.
With A = 0 the equation is linear and h = −c|q| − φq²(T − t) exactly. Every run solves that case on the same grid and reports the largest gap at the three plotted times.
The simulated exchange
60 seconds, initial mid 100, one-unit orders. Brownian mid-price, Poisson candidate orders at A=1 per side per second, exponential penetration with k=4 per price unit. Fee f=0.01 per fill; terminal liquidation c=0.12 per unit. All three policies share the same tape. The fixed spread quotes both sides 1/k + f = 0.26 from the mid at every refresh. The zero-flow skew uses the control's quote rule with the A = 0 value above, so it leans hard against inventory early in the run and relaxes toward the end.
A flow-linked jump moves the mid after matching, creating adverse selection. Quotes stay fixed between refreshes. Inventory bounds apply at every fill. Queue priority, partial fills, market impact, funding costs, tick rounding and measured exchange latency are outside the simulator; the refresh interval stands in for latency.
What the inference means
The paired 95% percentile bootstrap interval uses 1,500 resamples of per-path differences. It measures sampling noise inside the simulator; real markets are a separate question. The objective charges for carried inventory, so mean profit is only part of what the policy is solved for.
Stress cells reuse the seeds and freeze the original policy and both benchmarks, so they probe model risk. Parameters chosen after seeing results describe that choice, and an out-of-sample test would need fresh paths.
Research lineage
The starting point is the inventory-risk and exponential-fill framework in Avellaneda & Stoikov, and finite-inventory control studied by Guéant, Lehalle & Fernandez-Tapia.
This implementation uses a different objective, a quadratic running penalty on inventory, so it solves a different problem from their exponential-utility one. What it adds is a working solver, a simulator and an experiment whose result can go against the model.