vwapΒΆ
Defined in fynance.features.ohlcv
- vwap(high, low=None, close=None, volume=None, w=None)[source]
Volume-Weighted Average Price of the typical price, causal.
Typical price \(TP_t = (H_t + L_t + C_t) / 3\), weighted by volume. With
w=Noneit is the anchored (cumulative) VWAP; with an integerwit is a rolling VWAP over the trailing window.- Parameters:
- high, low, close, volumearray-like, or high = OHLCV
OHLCV series, or a single
OHLCV(volume required).- wint, optional
Rolling window;
None(default) = cumulative.
- Returns:
- numpy.ndarray
VWAP series, aligned with the input.
Examples
>>> import numpy as np >>> h = np.array([10., 12., 11.]) >>> low = np.array([8., 10., 9.]) >>> c = np.array([9., 11., 10.]) >>> v = np.array([100., 100., 100.]) >>> vwap(h, low, c, v).round(4) array([ 9., 10., 10.])