Volume-Synchronized Probability of Informed Trading (VPIN)

Calculate the Volume-Synchronized Probability of Informed Trading (VPIN) of Easley, López de Prado and O’Hara (2012) per asset and day, from daily bars: how one-sided, and thus toxic, the order flow is.

VPIN measures the toxicity of the order flow, the share of the volume that is one-sided: informed traders buy (or sell) persistently, while uninformed trading roughly balances. The volume is cut into buckets of the same size (a volume clock rather than a time clock), the volume of each bucket is split into buys and sells with the Bulk Volume Classification (a large rise is mostly buying, a day without a change half buying and half selling) and VPIN is the mean order imbalance over the last 50 buckets. A high VPIN means a one-sided market in which market makers lose to informed traders and may withdraw; the paper finds that VPIN was at its highest in the hours before the flash crash of 6 May 2010.

This is a coarse approximation of a measure designed for intraday data. The paper fills 50 buckets a day from one-minute bars, so its VPIN measures the toxicity within a day. On daily bars the finest classification is a whole day, which nets the buying and selling within it, and a bucket holds about a day of volume, so VPIN here is a slow-moving estimate of the one-sidedness of the volume over about 50 trading days. Use it to compare assets and periods, not as the published intraday VPIN or as a warning of an intraday liquidity crash.

The formula is as follows:

\[\Delta P_{t} = P_{t} - P_{t-1}\] \[V^{B_{t}} = V_{t} \cdot Z\left(\frac{\Delta P_{t}}{\sigma_{\Delta} P}\right)\] \[V^{B_{\tau}} = \text{the buy volume of the volume in bucket}\; \tau,\;\; V^{S_{\tau}} = V - V^{B_{\tau}}\] \[\text{VPIN} = \frac{\sum\left|V^{S_{\tau}} - V^{B_{\tau}}\right|}{n \cdot V} \;\text{over the last}\; n \;\text{buckets}\]

Where P is the Adjusted Close and \(V_{t}\) the Volume of day t, Z the cumulative distribution function of the standard normal distribution (or of the Student-t distribution with degrees_of_freedom), \(\sigma_{\Delta} P\) the sample standard deviation (with n - 1 in the denominator) of the price changes of the last window days, V the volume of a bucket and n the number of buckets.

Also known as: volume-synchronized probability of informed trading, flow toxicity, order flow toxicity, bulk volume classification, BVC.

Example · SNAP, ETSY, LYFT · 2024 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_vpin:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["SNAP", "ETSY", "LYFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2024-07-01",
    end_date="2025-06-30",
)

toolkit.risk.get_vpin()

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

How likely was informed trading in Snap, Etsy, Lyft and the S&P 500 over the last five trading days of June 2025, measured by the VPIN on a year of daily bars?

Which returns:

Parameters

get_vpin accepts the following parameters.

ParameterTypeDescriptionExample
bucketsintThe number of buckets n VPIN is the mean over. Defaults to 50, as in the paper.50, as in the paper
windowintThe number of days the standard deviation of the price changes of the classification is taken over. Defaults to 50.20
degrees_of_freedomfloat | NoneThe degrees of freedom of a Student-t distribution for the classification, as in Easley, López de Prado and O’Hara (2016), instead of the standard normal distribution. Defaults to None.None
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Easley, D., López de Prado, M., & O’Hara, M. (2012). “Flow Toxicity and Liquidity in a High-Frequency World.” The Review of Financial Studies, 25(5), 1457-1493.
  • Paper Easley, D., López de Prado, M., & O’Hara, M. (2016). “Discerning Information from Trade Data.” Journal of Financial Economics, 120(2), 269-285.
  • Paper López de Prado, M. (2018). “Advances in Financial Machine Learning.” Wiley, section 19.5.2.
  • Library Shares similar logic as RiskLabAI’s volume_synchronized_pin
Share