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

On-Balance Volume [Wikipedia](https://en.wikipedia.org/wiki/On-balance_volume).

A running total of volume, added when the close rises and subtracted
when it falls. Matching TA-Lib, the line is seeded with the first
bar's volume; the first bar itself carries no change.

Bars are maps with at least `:close` and `:volume`. See `TAlib` for the
remaining conventions: chronological order, oldest first, series
aligned with the input.

# `obv`

```elixir
@spec obv([map()]) :: number() | nil
```

Calculate the latest On-Balance Volume.

## Parameters

  - bars: list of bars, oldest first.

## Examples

    iex> bars = [
    ...>   %{close: 5, volume: 10},
    ...>   %{close: 6, volume: 20},
    ...>   %{close: 5, volume: 30},
    ...>   %{close: 7, volume: 40}
    ...> ]
    iex> TAlib.Indicators.OBV.obv(bars)
    40

# `obv_list`

```elixir
@spec obv_list([map()]) :: [number()]
```

Calculate the full On-Balance Volume series.

Returns a list aligned with `bars` (the first entry is the first
bar's volume, as in TA-Lib).

## Parameters

  - bars: list of bars, oldest first.

## Examples

    iex> bars = [
    ...>   %{close: 5, volume: 10},
    ...>   %{close: 6, volume: 20},
    ...>   %{close: 5, volume: 30},
    ...>   %{close: 7, volume: 40}
    ...> ]
    iex> TAlib.Indicators.OBV.obv_list(bars)
    [10, 30, 0, 40]

---

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