Covariance when assets trade at different times
Two stocks rarely trade at exactly the same instant. If their last observed prices are forced onto a very fine common grid, many returns are zero or refer to different periods. The resulting covariance can be misleading. Hayashi–Yoshida uses the original observation intervals and pairs returns whenever those intervals overlap.
Overlap creates covariance information
Illustrative 100-pair grid; the estimator uses overlapping return intervals, not matching timestamps.
What the estimator measures
Write and for two log-price processes. In a continuous diffusion model their integrated covariance over is
When prices are observed on the same fine grid, a natural estimate is the sum of matching return products. With irregular asynchronous observations for and for , define increments and . The Hayashi–Yoshida estimate is
Only intervals with positive-length overlap are counted; intervals that merely touch at an endpoint are not. Under suitable sampling and diffusion assumptions, as observations become dense the estimator converges to quadratic covariation. The diffusion expression above is the continuous-path case; with jumps, quadratic covariation also contains products of simultaneous jumps.
Work through the overlaps
Suppose is observed at 0, 2 and 4, with increments and . is observed at 0, 1, 3 and 4, with increments , and . The first interval overlaps the first two intervals; the second overlaps the last two. Therefore
This is an estimate of covariation over the observation window, in squared log-return units, not an annualized correlation. A correlation requires compatible variance estimates and a shared time window. In practice ensure both series cover the window consistently; an interval that extends beyond the boundary introduces exposure outside the intended window unless handled explicitly.
A simple implementation
The following clear implementation checks every pair, making it suitable for a small example. A production implementation can exploit sorted timestamps to visit overlapping intervals without constructing every pair.
import numpy as np
def hayashi_yoshida(tx, x, ty, y):
"""Log prices with strictly increasing timestamps on a shared window."""
tx, x, ty, y = map(np.asarray, (tx, x, ty, y))
if len(tx) != len(x) or len(ty) != len(y) or len(tx) < 2 or len(ty) < 2:
raise ValueError("each price needs a timestamp and at least two observations")
if np.any(np.diff(tx) <= 0) or np.any(np.diff(ty) <= 0):
raise ValueError("timestamps must be strictly increasing")
if tx[0] != ty[0] or tx[-1] != ty[-1]:
raise ValueError("series must cover the same observation window")
dx, dy = np.diff(x), np.diff(y)
overlap = np.maximum(tx[:-1, None], ty[None, :-1]) < np.minimum(tx[1:, None], ty[None, 1:])
return np.sum(dx[:, None] * dy[None, :] * overlap)
The code assumes timestamps support subtraction and comparison and that the observations at the shared boundaries are available. It does not solve cleaning, exchange-clock alignment, or microstructure noise.
What asynchrony does not explain
At very short horizons measured correlations often decrease, a phenomenon known as the Epps effect. Asynchronous observations can contribute, but delayed price discovery, market structure, and noise can also matter. The HY estimator addresses interval mismatch; it does not establish that all short-horizon correlation differences are sampling artifacts.
Before using the estimate
- Bid–ask bounce and other observation noise can bias high-frequency covariance estimates; use an appropriate noise-robust method and study sampling sensitivity.
- A pairwise covariance matrix assembled from asynchronous estimates need not be positive semidefinite. Portfolio optimization may require a compatible multivariate estimator or an explicit adjustment.
- Covariance and correlation are different quantities. Make the variance estimators, sampling window and units consistent before normalizing.
- Time stamps, trading halts, stale quotes and cross-venue clock differences require cleaning before estimation.
Practice
OverlapDoes an X return over (0, 2] pair with a Y return over (2, 3]?Show answer
No. The intervals meet at 2 but have no positive-length overlap.
SynchronousWhat does the estimator become when both series use the same non-overlapping observation grid?Show answer
Each interval overlaps only its counterpart, so the sum reduces to the usual sum of matching return products.
NoiseDoes using all asynchronous observations automatically eliminate bid–ask bounce?Show answer
No. The basic estimator addresses nonsynchronous intervals, not observation noise.
Further reading: Voev and Lunde, Integrated Covariance Estimation using High-frequency Data in the Presence of Noise; Christensen, Kinnebrock, and Podolskij, Pre-averaging estimators of the ex-post covariance matrix.