Calculate the Positive Volume Index (PVI) for a given price series.

The Positive Volume Index mirrors the Negative Volume Index: it is a cumulative index that only updates on days where volume increases from the prior period, compounding that day’s percentage price change onto the running index; on days where volume decreases (or stays flat), the index is carried forward unchanged. Per Fosback, the Positive Volume Index isolates price behavior on high-volume (crowd-driven) days, which is traditionally read as tracking less-informed, sentiment-driven trading.

The formula is as follows:

\[\operatorname{Index}(t) = \operatorname{Index}(t-1) \cdot (1 + (\operatorname{Close}(t) / \operatorname{Close}(t-1) - 1)) \text{if Volume} (t) > \operatorname{Volume}(t-1)\] \[\operatorname{Index}(t) = \operatorname{Index}(t-1) \text{otherwise}\]

Also known as: PVI, Positive Volume Index.

Positive Volume Index (PVI) in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_positive_volume_index as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_positive_volume_index()

Parameters

The function accepts the following parameters:

  • period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
  • close_column (str, optional): The column name for closing prices in the historical data. Defaults to “Adj Close”.
  • start_value (float, optional): The index value to start the series at. Defaults to 1000.0.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the Positive Volume Index. Defaults to False.
  • lag (int | list[int], optional): The lag to use for the growth calculation.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.
Share