Day 298 — Implementation shortfall counts the trade you missed
Monday, 31 May 2027 · Week 43 of 52 · Microstructure · Study day · 60 min
It is the only execution metric that charges you for not trading, which is why it is the honest one and why algorithms optimised against VWAP can look good while losing money.
What you should be able to do tonight
- Decompose implementation shortfall into its standard components including opportunity cost.
- Say what it captures that VWAP slippage does not, with an example where the two disagree.
Tasks 60 min
35 min Implement the decomposition in qlib/exec/shortfall.py: the difference between the decision price and the achieved price, split into delay cost, trading cost against the arrival price, and the opportunity cost of the unfilled quantity valued at the closing price. Assert the components sum to the total.
25 min Construct the disagreement: a passive algorithm that fills only when the price comes to it will beat VWAP on the fills it gets and will fail to fill when the price runs away, which is exactly when not filling is most expensive. Simulate that case and report both metrics to show the divergence.
The running strategy
qlib/exec/shortfall.py measures implementation shortfall with opportunity cost included and its components reconciling to the total, which becomes the standard execution metric for the paper account in phase 10.
Resources
Deliverable
An implementation shortfall decomposition that reconciles, plus a simulated case where it and VWAP slippage disagree.
Checkpoint
Describe implementation shortfall and say what it captures that VWAP slippage does not.
Prepare for tomorrow
Ten minutes tonight so Day 299, Tuesday, 1 June 2027 starts clean. This is what the evening email sends you.
Check your Alpaca paper account is still active and can place orders.
Place two small paper orders in a liquid name, one market and one limit, and record the timestamps and fills.
You are going to measure your own slippage tomorrow and you need real fills to do it.