vwap()

Aggregate. The vwap function computes a volume-weighted average price for a set of transactions.

Syntax

vwap ( price, quantity )

Parameters

price

The name of the column containing the price in a set of transaction records.

quantity

The name of the column containing the number of units traded at the specified price in a set of transaction records.

Note: For both of these parameters, you can specify an expression containing the column name, but you must include the column name.

Usage

The volume-weighted average price (VWAP) is a measure of the average price a stock is traded at over some period of time. For each trade, it determines the value by multiplying the price paid per share times the number of shares traded. Then it takes the sum of all these values and divides it by the sum of all the shares traded. The volume-weighted average price is computed using the following formula:



The vwap function takes the price paid and the number of shares traded as arguments. As an input stream or window delivers trading events, the vwap function computes the VWAP to track the average price at which a stock has traded.