Calculate the Volume Weighted Average Price (VWAP) for a given price series.

The Volume Weighted Average Price (VWAP) weighs the typical price of each period by its traded volume over a rolling window, giving a more volume-informed view of the average price than a plain moving average.

The formula is as follows:

\[\text{Typical Price} = (\text{High} + \text{Low} + \text{Close}) / 3\] \[\text{VWAP} = \operatorname{Sum}(\text{Typical Price} \cdot \text{Volume},\; \text{Window}) / \operatorname{Sum}(\text{Volume},\; \text{Window})\]

The VWAP that trading desks use as an execution benchmark is calculated from the trades of a single session and resets every day. This method computes a rolling VWAP over several periods from the high, low, close and volume of each period, which works as a volume-weighted moving average, not as the intraday benchmark against which fills are measured.

Also known as: VWAP.

Volume Weighted Average Price (VWAP) in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_volume_weighted_average_price as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["SPY"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
    benchmark_ticker=None,
)

toolkit.technicals.get_volume_weighted_average_price().tail(5)

Or, after setting up the Finance Toolkit MCP, ask:

What was the volume weighted average price of SPY from 24 to 31 December 2025?

Which returns:

Date SPY
2025-12-24 675.242
2025-12-26 675.346
2025-12-29 675.664
2025-12-30 675.891
2025-12-31 675.847

Parameters

get_volume_weighted_average_price accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the open, high and low prices are adjusted for dividends in the same way."Close"
windowintNumber of periods to consider for the VWAP. The number of periods (time intervals) over which to calculate the VWAP. Defaults to 14.20
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the VWAP. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
Share