Volume Weighted Average Price (VWAP)
get_vwap(quotes, start=None)
get_vwap(quotes, year, month=1, day=1, hour=0, minute=0)
Parameters
name | type | notes |
---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
start | datetime, Optional | The anchor date used to start the VWAP accumulation. The earliest date in quotes is used when not provided. |
year , month , day , hour , minute | int, Optional | The anchor date used to start the VWAP accumulation. The earliest date in quotes is used when not provided. |
Historical quotes requirements
You must have at least one historical quote to calculate; however, more is often needed to be useful. Historical quotes are typically provided for a single day using minute-based intraday periods. Since this is an accumulated weighted average price, different start dates will produce different results. The accumulation starts at the first period in the provided quotes
, unless it is specified in the optional start
parameter.
quotes
is an Iterable[Quote]
collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
Return
VWAPResults[VWAPResult]
- This method returns a time series of all available indicator values for the
quotes
provided. VWAPResults
is just a list ofVWAPResult
.- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first period or the
start
will have avwap = close
value since it is the initial starting point. vwap
values beforestart
, if specified, will beNone
.
VWAPResult
name | type | notes |
---|---|---|
date | datetime | Date |
vwap | float, Optional | Volume Weighted Average Price |
Utilities
See Utilities and Helpers for more information.
Example
from stock_indicators import indicators
# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")
# Calculate
results = indicators.get_vwap(quotes);
About Volume Weighted Average Price (VWAP)
The Volume Weighted Average Price is a Volume weighted average of Close price, typically used on intraday data. [Discuss] 💬