Summary
Add a VWAP (Volume-Weighted Average Price) execution algorithm alongside the existing TWAP implementation.
The Rust algorithm module comments already mention VWAP as an intended algorithm (line 19 of crates/core/src/nanos.rs docs reference "algorithms like TWAP and VWAP"), and ExecAlgorithmId("VWAP") appears in serialization tests, but no implementation exists.
Proposed implementation
A VWAPExecAlgorithm in nautilus_trader/examples/algorithms/vwap.py following the TWAP pattern:
- Static volume profile: accepts a
volume_weights list (default: U-shaped intraday curve) that determines the proportion of total quantity to execute in each interval
- Same timer-based execution as TWAP:
horizon_secs + interval_secs parameters, timer callback spawns market orders
- Volume-weighted slicing: instead of equal splits, each interval's quantity is proportional to its weight in the profile
Parameters (via exec_algorithm_params)
| Parameter |
Type |
Description |
horizon_secs |
float |
Total execution time window |
interval_secs |
float |
Time between child order submissions |
volume_weights |
list[float] (optional) |
Per-interval volume weights. Normalized internally. Default: U-shaped curve. |
Example usage
order = self.order_factory.market(
instrument_id=BTCUSDT,
order_side=OrderSide.BUY,
quantity=Quantity.from_str("1.000"),
exec_algorithm_id=ExecAlgorithmId("VWAP"),
exec_algorithm_params={
"horizon_secs": 60.0,
"interval_secs": 10.0,
"volume_weights": [3, 2, 1, 1, 2, 3], # U-shaped
},
)
Motivation
VWAP is the most widely used execution benchmark in institutional trading. A static-profile implementation provides immediate value while a future enhancement could add live market volume tracking (participation-rate mode).
Summary
Add a VWAP (Volume-Weighted Average Price) execution algorithm alongside the existing TWAP implementation.
The Rust algorithm module comments already mention VWAP as an intended algorithm (line 19 of
crates/core/src/nanos.rsdocs reference "algorithms like TWAP and VWAP"), andExecAlgorithmId("VWAP")appears in serialization tests, but no implementation exists.Proposed implementation
A
VWAPExecAlgorithminnautilus_trader/examples/algorithms/vwap.pyfollowing the TWAP pattern:volume_weightslist (default: U-shaped intraday curve) that determines the proportion of total quantity to execute in each intervalhorizon_secs+interval_secsparameters, timer callback spawns market ordersParameters (via
exec_algorithm_params)horizon_secsinterval_secsvolume_weightsExample usage
Motivation
VWAP is the most widely used execution benchmark in institutional trading. A static-profile implementation provides immediate value while a future enhancement could add live market volume tracking (participation-rate mode).