Indicado.OBV (Indicado v0.0.4) View Source

This is the OBV module used for calculating On-Balance Volume

Link to this section Summary

Types

The argument passed to eval functions should be a list of ovb_data_map type.

Functions

Calculates OBV for the list. The list argument passed to eval function should be list of ovb_data_map type.

Calculates OBV for the list. The list argument passed to eval function should be list of ovb_data_map type.

Link to this section Types

Specs

ovb_data_map() :: %{close: float(), volume: float()}

The argument passed to eval functions should be a list of ovb_data_map type.

Link to this section Functions

Specs

eval([ovb_data_map(), ...]) ::
  {:ok, [float(), ...]} | {:error, :not_enough_data}

Calculates OBV for the list. The list argument passed to eval function should be list of ovb_data_map type.

Returns {:ok, ovb_list} or {:error, :not_enough_data}

## Examples

 iex> Indicado.OBV.eval([%{close: 1, volume: 2}, %{close: 2, volume: 5}])
 {:ok, [5]}

 iex> Indicado.OBV.eval([%{close: 2, volume: 3}, %{close: 1, volume: 5}])
 {:ok, [-5]}

 iex> Indicado.OBV.eval([%{close: 2, volume: 3}, %{close: 1, volume: 5}, %{close: 2, volume: 4}])
 {:ok, [-5, -1]}

 iex> Indicado.OBV.eval([])
 {:error, :not_enough_data}

Calculates OBV for the list. The list argument passed to eval function should be list of ovb_data_map type.

Raises NotEnoughDataError if the given list lenght is zero.

## Examples

 iex> Indicado.OBV.eval!([%{close: 1, volume: 1}, %{close: 2, volume: 3}])
 [3]

 iex> Indicado.OBV.eval!([%{close: 1, volume: 1}, %{close: 1, volume: 3}])
 [0]

 iex> Indicado.OBV.eval!([])
 ** (NotEnoughDataError) not enough data