Destiny
Sign In
ACD-21 · Quantitative Execution Microstructure & L2 Limit-Order-Book Math

Almgren-Chriss Optimal Execution, L2 Orderbook Imbalance & VPIN Toxicity

Paper backtests that fill arbitrary parent orders at historical midprice systematically overstate realized Sharpe ratios. Below is the discrete-time implementation-shortfall algebra, 20-level limit-order-book microprice weighting, and volume-clock flow-toxicity measurement used alongside Destiny Trader’s 1-second charts and L2 depth heatmaps.

1. Discrete Almgren-Chriss Mean-Variance Implementation Shortfall

Suppose a portfolio schedule liquidates X units across N slices t_0 < t_1 < ... < t_N = T of step tau = T / N, holding remaining inventory x_k and trading n_k = x_{k-1} - x_k per interval. Separating permanent linear impact gamma from temporary liquidity-taking impact eta under arithmetic Brownian volatility sigma yields expected shortfall E[x] and timing variance V[x]:

E[x] = 0.5 * gamma * X^2 + eta_tilde * sum_(k=1..N) (n_k^2 / tau)
V[x] = sigma^2 * sum_(k=1..N) tau * x_k^2
// Minimizing E[x] + lambda * V[x] produces the exact hyperbolic inventory curve:
kappa = arccosh(1 + (lambda * sigma^2 * tau^2) / (2 * eta_tilde)) / tau
x_j   = X * sinh(kappa * (T - t_j)) / sinh(kappa * T)
// Limit lambda -> 0 recovers uniform TWAP: x_j = X * (T - t_j) / T

2. Multi-Level L2 Queue Imbalance & Microprice Estimator

Inside a 20-level limit order book with bid levels (P_m^b, V_m^b) and ask levels (P_m^a, V_m^a) for m = 1..20, top-of-book imbalance I_1 = V_1^b / (V_1^b + V_1^a) anchors the first-order microprice, while exponentially distance-decayed depth imbalance OFI_20 captures deeper support and resistance walls without flickering on 1-lot spoofing at level 1:

P_micro  = I_1 * P_1^a + (1 - I_1) * P_1^b
w_m      = exp(-alpha * (m - 1))            // Level decay across m = 1..20
DepthImb = (sum_m w_m * V_m^b - sum_m w_m * V_m^a) / (sum_m w_m * (V_m^b + V_m^a))

3. Volume-Clock Bucketing & Order-Flow Toxicity (VPIN)

Partitioning continuous trade prints into equal-volume buckets of size V_bucket (for example 1/50th of rolling daily volume) classifies signed aggressive buy volume V_tau^B and sell volume V_tau^S = V_bucket - V_tau^B per bucket tau. Rolling across n volume buckets yields VPIN = (1 / (n * V_bucket)) * sum_{tau=1..n} |V_tau^B - V_tau^S|, bounded cleanly on [0, 1] so rising adverse-selection regimes surface before bid-ask spreads widen.

4. Live 1-Second Perpetual Microstructure Streams

Compare real-time 1-second BTC-USD and ETH-USD candle formation and volume velocity below, or launch the full 20-level L2 heatmap at /trade.

Hyperliquid L1 FeedBTC-USD · 1s · EMA-9 + Volume · Informational Only
LAST PRICE
--
WINDOW CHANGE
+0.00%
WINDOW VOLUME
Live
REALIZED σ (ANN)
--
Loading BTC-USD 1s bars from /v1/markets/bars...
Informational market analytics only · Not investment advice.
Open Full 1s Terminal →
Hyperliquid L1 FeedETH-USD · 1s · EMA-9 + Volume · Informational Only
LAST PRICE
--
WINDOW CHANGE
+0.00%
WINDOW VOLUME
Live
REALIZED σ (ANN)
--
Loading ETH-USD 1s bars from /v1/markets/bars...
Informational market analytics only · Not investment advice.
Open Full 1s Terminal →
Destiny Trader: 1s Supercharts · 914 FeedsZero Trackers · Cross-Origin SVG
Embed Live 1s Market Telemetry Badge

Link quantitative notebooks and market research repositories directly to live 1-second Supercharts.

FAQ · DIRECT ANSWERS

Optimal Execution, L2 Microprice & VPIN — FAQ

Direct answers on hyperbolic execution decay, queue-weighted microprice, volume-time bucketing, and non-advisory analytical boundaries.

04 Questions
Why does the Almgren-Chriss optimal execution schedule deviate from uniform TWAP?
Time-Weighted Average Price (TWAP) minimizes temporary linear market impact when risk aversion lambda = 0, but leaves remaining inventory exposed to price variance sigma^2 over the horizon T. For lambda > 0, minimizing E[Cost] + lambda * Var[Cost] yields a hyperbolic sinh trajectory that front-loads execution at rate kappa = arccosh(1 + (lambda * sigma^2 * tau^2) / (2 * eta)).
Why is queue-weighted microprice a cleaner short-horizon fair-value anchor than arithmetic midprice?
Arithmetic midprice (P_bid + P_ask) / 2 ignores resting queue depth asymmetry. When bid size V_bid is tiny relative to ask size V_ask, random cancellations or a single market sell sweep the bid first; weighting opposite prices by top-of-book imbalance I = V_bid / (V_bid + V_ask) gives P_micro = I * P_ask + (1 - I) * P_bid.
Why compute order-flow toxicity in volume buckets rather than fixed 1-minute wall-clock bars?
During liquidity cascades and macro releases, trading velocity accelerates by 10x to 50x per wall-clock minute. Sampling fixed volume buckets V_bucket equalizes information arrival per observation and prevents quiet overnight intervals from distorting rolling order-imbalance standard deviations.
Does Destiny Trader execute live brokerage orders or provide investment advice?
No. On nandai.org (/trade), Destiny provides impersonal 1-second charting, 20-level L2 orderbook visualization, and $100,000 simulated paper-trading analytics strictly for informational and educational study under Lowe v. SEC (472 U.S. 181), CSA NI 31-103, and CFTC Rule 4.41.