fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Adaptive VWAP Execution

Install and import#

bash
npm install fintech-algorithms
ts
import { adaptiveVwapExecution } from "fintech-algorithms/execution-and-transaction-cost-analysis/schedule-based-execution/adaptive-vwap-execution";

Signature#

adaptiveVwapExecution(total_quantity, realized_market_volumes, remaining_forecast_volumes, executed_quantity, lot_size, forecast_version)

Re-plans the remaining schedule from realised volume so far plus a forecast of what is left. Catches up when the market is busier than expected, and slows when it is not.

Parameters#

NameTypeNotes
total_quantitynumberTotal quantity.
min: 1 · integer: true
realized_market_volumesnumber[]Volume actually observed in elapsed buckets.
remaining_forecast_volumesnumber[]Forecast volume for the remaining buckets.
executed_quantitynumberQuantity already executed.
min: 0 · integer: true
lot_sizenumberLot size.
min: 1 · integer: true
forecast_versionstringWhich forecast produced the remaining profile, recorded for attribution.

Returns#

{ schedule, catch_up_quantity, participation, forecast_version, … }

The revised schedule with the catch-up implied by the shortfall so far.

Errors#

  • When executed_quantity exceeds total_quantity — throws

Complexity: time O(buckets), space O(buckets).

Worked example#

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input#

total_quantity
24000
realized_market_volumes
[2600, 2100, 1800, 1600, 1450, 1300]

Showing 6 of 8 elements.

remaining_forecast_volumes
[950, 900, 900, 950, 1000, 1050]

Showing 6 of 16 elements.

executed_quantity
5200
lot_size
100
forecast_version
"SYN-LIVE-2026-07-30T14:00Z"

Call#

adaptiveVwapExecution(total_quantity, realized_market_volumes, remaining_forecast_volumes, executed_quantity, lot_size, forecast_version)

Returns#

object with 14 fields: forecast_version, total_quantity, executed_quantity, remaining_quantity_before_schedule, realized_market_volume, remaining_forecast_market_volume, projected_market_volume, target_completed_quantity, …

{
  "forecast_version": "SYN-LIVE-2026-07-30T14:00Z",
  "total_quantity": 24000,
  "executed_quantity": 5200,
  "remaining_quantity_before_schedule": 18800,
  "realized_market_volume": 13250,
  "remaining_forecast_market_volume": 26050,
  "projected_market_volume": 39300,
  "target_completed_quantity": 8000,
  "pacing_error_quantity": -2800,
  "pacing_state": "behind",
  "immediate_catch_up_quantity": 2800,
  "scheduled_future_quantity": 18800,
  "schedule": [
    {
      "future_bucket": 1,
      "forecast_market_volume": 950,
      "target_quantity": 3400,
      "target_cumulative_quantity": 8600,
      "includes_catch_up_quantity": 2800
    },
    {
      "future_bucket": 2,
      "forecast_market_volume": 900,
      "target_quantity": 600,
      "target_cumulative_quantity": 9200,
      "includes_catch_up_quantity": 0
    },
    {
      "future_bucket": 3,
      "forecast_market_volume": 900,
      "target_quantity": 600,
      "target_cumulative_quantity": 9800,
      "includes_catch_up_quantity": 0
    }
  ],
  "state": "adaptive-schedule"
}

Other exports#

This module also exports twapExecution, historicalVwapExecution, percentageOfVolumeExecution, calculate. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Adaptive VWAP Execution — system map

Calculation flow#

Adaptive VWAP Execution calculation flow
flowchart LR
    S1["Validate parent realized data forecast executed quanti"]
    S2["Project total market volume"]
    S3["Calculate lotfloored target completed now"]
    S4["Classify aheadbehind and compute catchup"]
    S5["Allocate postcatchup lots by remaining forecast"]
    S1 --> S2
    S2 --> S3
    S3 --> S4
    S4 --> S5
    S5 --> D{"executed quantity equal to the target completed quantity"}
    D --> O["pacing_state + diagnostics"]
    O --> A["Audit: Executed plus scheduled future quantity equals the parent"]

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Schedule-Based Execution family#