Skip to content

[Feature] VWAP execution algorithm #3839

Description

@JKDasondee

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions