Back to Community
VWAP

Has there been any progress towards producing either/or 1) an end of day VWAP or 2) a cumulative VWAP. My understanding is that Quantitopian already has the underlying data items necessary to calculate a variety of such measures.

4 responses

Is the built-in VWAP factor not what you're looking for? By default, it looks like it's using the EOD close prices and total volume of the day, and that one has to define a window_length.

class VWAP(*args, **kwargs)  
Volume Weighted Average Price

Default Inputs: [USEquityPricing.close, USEquityPricing.volume]

Default Window Length: None  

One could potentially also create one's own VWAP calculation, using:

class WeightedAverageValue(*args, **kwargs)  
Helper for VWAP-like computations.

Default Inputs: None

Default Window Length: None  

The standard daily VWAP definition is:

VWAP is calculated by adding up the dollars traded for every transaction (price multiplied by number of shares traded) and then dividing by the total shares traded for the day.

There is guidance here that it can be computed from minute bars using:

sum(V*(H+L+C)/3) / sum(V)  

It might be possible to perform the computation within before_trading_start using trailing minute bars. In theory, it would seem that Quantopian could do the estimated VWAP computation using minute bars, and then make the result available to Pipeline.

Joakim, I believe that the VWAP function you show works on one day time interval and so it would be an approximation of the true VWAP. What I would like is a VWAP measure using Grant's definition. Baring that, a VWAP based on minute time slices for an End-Of-Day VWAP and also a cumulative VWAP over the course of the day. In addition to its value as a factor, VWAP is used by institutional investors as the acid test, especially as their trades become an increaing percentage of daily volume.

Hi Eric -

My recollection from prior Quantopian feedback on the forum is that a true VWAP is not available. So, you'd need to use an estimate derived from minute bars. An alternative approach would be to upload your own VWAP data, using the new Self-Serve Data API. However, it only supports daily data, for Pipeline input.