Negative Volume Index (NVI)
Calculate the Negative Volume Index (NVI) for a given price series.
The Negative Volume Index is a cumulative index that only updates on days where volume decreases from the prior period, compounding that day’s percentage price change onto the running index; on days where volume increases (or stays flat), the index is carried forward unchanged. The premise, per Fosback, is that “smart money” tends to be active on low-volume (quiet) days, so tracking price behavior specifically on those days isolates informed trading from the noise of high-volume, crowd-driven days.
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: NVI, Negative Volume Index.
Negative Volume Index (NVI) in Python
get_negative_volume_index is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_negative_volume_index as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_negative_volume_index()
Parameters
get_negative_volume_index 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 Negative 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.