Jump Test
Calculate the jump test of every day from its intraday returns: whether the price jumped within the day, from how far its realized variance exceeds its bipower variation.
Without jumps the realized variance and the bipower variation (see get_realized_variance) estimate the same integrated variance, and their relative gap is asymptotically normal (Barndorff-Nielsen and Shephard, 2006). The test uses the ratio statistic with the tripower quarticity, bounded below as in the formula, which Huang and Tauchen (2005) found to keep its size best on finite samples. A day with a significant statistic has its jump variation as its jump component (Andersen, Bollerslev and Diebold, 2007), such as the day of an earnings announcement or a macroeconomic release.
The formula is as follows, with M the number of intraday returns of the day:
\[\text{Relative Jump} = \frac{\text{Realized Variance} - \text{Bipower Variation}}{\text{Realized Variance}}\] \[\text{Tripower Quarticity} = M \cdot \mu_{4/3}^{-3} \cdot \frac{M}{M - 2} \cdot \sum_{j=3}^{M}\left(\left|r_{j}\right|^{\frac{4}{3}} \cdot \left|r_{j-1}\right|^{\frac{4}{3}} \cdot \left|r_{j-2}\right|^{\frac{4}{3}}\right)\] \[\text{z-Statistic} = \frac{\text{Relative Jump}}{\sqrt{\left(\left(\frac{\pi}{2}\right)^{2} + \pi - 5\right) \cdot \frac{1}{M} \cdot \max\left(1,\; \frac{\text{Tripower Quarticity}}{\text{Bipower Variation}^{2}}\right)}}\] \[\text{p-Value} = 1 - N(\text{z-Statistic}),\;\; \text{one-sided, with } N \text{ the standard normal distribution}\] \[\text{Significant Jump Variation} = \max(\text{Realized Variance} - \text{Bipower Variation},\; 0) \;\text{when the z-Statistic exceeds}\; N^{-1} (1 - \alpha),\;\; \text{else 0}\]Where \(r_{j}\) are the intraday log returns and the Realized Variance and Bipower Variation those of get_realized_variance, and \(\mu_{\tfrac{4}{3}} = 2^{\tfrac{2}{3}}\) * Gamma(7/6) / Gamma(1/2) = E|Z|^(4/3) of a standard normal Z. The tripower quarticity estimates the integrated quarticity, which sets the variance of the statistic.
Also known as: BNS jump test, Barndorff-Nielsen Shephard jump test, Huang-Tauchen test, ratio jump statistic, intraday jump detection, jump component.
Example · AAPL, MSFT · 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_jump_test:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-12-22",
end_date="2025-12-31",
intraday_period="5min",
)
toolkit.risk.get_jump_test()["p-Value"]
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2025-12-22 | 0.7609 | 0.0001 | 0.3991 |
| 2025-12-23 | 0.8155 | 0.2146 | 0.1185 |
| 2025-12-24 | 0.0321 | 0.7255 | 0.5802 |
| 2025-12-26 | 0.5880 | 0.1077 | 0.7052 |
| 2025-12-29 | 0.8087 | 0.2618 | 0.6111 |
| 2025-12-30 | 0.4424 | 0.0000 | 0.0444 |
| 2025-12-31 | 0.2173 | 0.7474 | 0.5194 |
7 rows
Parameters
get_jump_test accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
alpha | float | The significance level of the one-sided test. Defaults to 0.05. | 0.01 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
show_columns | str | list[str] | None | The 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 Barndorff-Nielsen, O.E. and Shephard, N. (2006). “Econometrics of Testing for Jumps in Financial Economics Using Bipower Variation.” Journal of Financial Econometrics, 4(1), 1-30.
- Paper Huang, X. and Tauchen, G. (2005). “The Relative Contribution of Jumps to Total Price Variance.” Journal of Financial Econometrics, 3(4), 456-499.
- Paper Andersen, T.G., Bollerslev, T. and Diebold, F.X. (2007). “Roughing It Up: Including Jump Components in the Measurement, Modeling, and Forecasting of Return Volatility.” The Review of Economics and Statistics, 89(4), 701-720.