# `TAlib.Indicators.VWAP`
[🔗](https://github.com/benyblack/talib/blob/main/lib/indicators/vwap.ex#L1)

Volume Weighted Average Price [Wikipedia](https://en.wikipedia.org/wiki/Volume-weighted_average_price).

This is the **rolling** VWAP: over each lookback window it is
`sum(TP * volume) / sum(volume)` with the typical price
`TP = (high + low + close) / 3` — not the session-anchored variant that
resets every trading day.

Bars are maps with at least `:high`, `:low`, `:close` and `:volume`. See
`TAlib` for the remaining conventions: chronological order, oldest
first, series aligned with the input, `nil` when there is not enough
data.

# `vwap`

```elixir
@spec vwap([map()], pos_integer()) :: float() | nil
```

Calculate the latest rolling VWAP.

## Parameters

  - bars: list of bars, oldest first.
  - period: lookback window, a positive integer (default 14).

## Examples

    iex> bars = [
    ...>   %{high: 11, low: 9, close: 10, volume: 100},
    ...>   %{high: 12, low: 8, close: 11, volume: 300}
    ...> ]
    iex> TAlib.Indicators.VWAP.vwap(bars, 2)
    10.25

# `vwap_list`

```elixir
@spec vwap_list([map()], pos_integer()) :: [float() | nil]
```

Calculate the full rolling VWAP series in a single pass (sliding
price-volume and volume sums).

Returns a list aligned with `bars`: the first `period - 1` entries are
`nil`, and every later entry is the volume-weighted average price of
the window ending at that point.

## Parameters

  - bars: list of bars, oldest first.
  - period: lookback window, a positive integer (default 14).

## Examples

    iex> bars = [
    ...>   %{high: 11, low: 9, close: 10, volume: 100},
    ...>   %{high: 12, low: 8, close: 11, volume: 300}
    ...> ]
    iex> TAlib.Indicators.VWAP.vwap_list(bars, 2)
    [nil, 10.25]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
