Volume Weighted Moving Average (VWMA)
get_vwma(quotes, lookback_periods)
Parameters
| name | type | notes |
|---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
lookback_periods | int | Number of periods (N) in the moving average. Must be greater than 0. |
Historical quotes requirements
You must have at least N periods of quotes to cover the warmup periods.
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
VWMAResults[VWMAResult]
- This method returns a time series of all available indicator values for the
quotesprovided. VWMAResultsis just a list ofVWMAResult.- 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
N-1periods will haveNonevalues forVwmasince there’s not enough data to calculate.
VWMAResult
| name | type | notes |
|---|---|---|
date | datetime | Date |
vwma | float, Optional | Volume Weighted Moving Average |
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 10-period VWMA
results = indicators.get_vwma(quotes, 10)
About Volume Weighted Moving Average (VWMA)
Volume Weighted Moving Average is the volume adjusted average price over a lookback window. [Discuss] 💬
