Free lesson · Trading algorithms
TWAP, VWAP and percentage-of-volume execution
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Execution algorithms schedule a parent order. They usually aim to balance urgency, benchmark tracking and liquidity consumption; they do not by themselves decide whether the investment should be held.
Symbols, units & horizon
- Q: parent quantity
- N: time buckets
- q_i: scheduled quantity in bucket i
- V̂_i: forecast volume for VWAP scheduling
- V_external: observed external volume in this teaching POV convention
- ρ: target fraction of external volume
- Actual fills: may differ from scheduled quantities
- Final bucket: handle rounding and remaining quantity
When and why to use this
Use scheduling algorithms to implement a parent order consistently and compare benchmark tracking, cost and completion risk.
TWAP spreads quantity across time buckets, making a simple schedule without a volume forecast. VWAP-oriented scheduling follows an estimated intraday volume profile. Percentage-of-volume execution adapts to observed market volume, subject to completion and participation constraints.
The VWAP benchmark is a realised volume-weighted price; a prospective VWAP schedule must use volume estimates available then. Using the day’s final volume curve to schedule earlier trades is hindsight. POV’s denominator convention matters: some participation definitions include your own prints, while others use external volume.
Choose based on urgency, liquidity profile, information decay and benchmark. A passive schedule can miss completion; an urgent schedule pays spread and impact. Commercial implementations include venue, order-type and risk logic beyond the teaching formulas, so actual behaviour must be read from current broker specifications.
TWAP, VWAP and percentage-of-volume execution
- TWAP allocates equal fractions of Q across N intervals.
- VWAP normalises the forecast volume profile to fractions summing to one, then multiplies by Q.
- POV multiplies observed external volume by the desired fraction and caps at the remaining order. If participation includes own volume, solve q/(V_external+q)=ρ, giving q=ρV_external/(1−ρ) instead.
For Q=1000 and forecast volumes [1,2,1], VWAP schedule is [250,500,250], while TWAP is approximately [333.33,333.33,333.33]. A 10% external-volume rule trades 200 against 2000 external units, capped by remaining quantity.
Apply it in a strategy
- State parent quantity, deadline, benchmark, participation denominator and allowed order types.
- Forecast volume from past comparable sessions or use a causal realised-volume rule.
- Backtest scheduled versus filled quantities, slippage and unfilled terminal obligations under the same market conditions.
Research deliverable
Create a schedule and fill ledger for TWAP, forecast-VWAP and POV, including rounding, completion and cost assumptions.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
def schedules(quantity,volume_forecast):
if quantity<0 or not volume_forecast or any(v<0 for v in volume_forecast) or sum(volume_forecast)<=0: raise ValueError("Valid schedule inputs required")
return [quantity/len(volume_forecast)]*len(volume_forecast),[quantity*v/sum(volume_forecast) for v in volume_forecast]
def pov_external(volume,participation,remaining):
if min(volume,participation,remaining)<0 or participation>1: raise ValueError("Invalid participation inputs")
return min(remaining,participation*volume)
print(schedules(1000,[1,2,1]),pov_external(2000,.1,1000))Continue learning
Trading Algorithms: A Practical Selection Guide — all lessons- Moving averages, EWMA and momentum/reversion rules
- Kalman filtering: combine a prediction with a noisy observation
- ARIMA for conditional means and GARCH for conditional variance
- Linear models, random forests and gradient boosting
- PCA, clustering, risk parity and quadratic programming
- TWAP, VWAP and percentage-of-volume execution
- Optimal execution: impact versus waiting risk
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations