Amihud Illiquidity in Python: Measuring Price Impact from Daily Data

How much does a stock’s price move when one dollar of trading volume hits the tape? Amihud ILLIQ answers that with daily data, turning absolute returns and dollar volume into a rough price-impact estimate.

Amihud ILLIQ is the average daily absolute return divided by dollar volume. It estimates how much a stock’s price moves per dollar traded, using only daily close and share volume. In Python, build dollar volume, compute the ratio, average it by ticker and calendar year, and keep ticker-years with more than 150 valid days.

This guide is based on the original paper and public documentation; the code is a demonstration on synthetic data, not a result for any listed stock.

What ILLIQ measures

Equation 1 in Amihud (2002) defines ILLIQ as the average over days of the absolute return divided by dollar volume:

ILLIQ_iy = (1 / D_iy) * sum over t of ( |R_iyt| / VOLD_iyt )

where R_iyt is the daily return, VOLD_iyt is that day’s dollar volume, and D_iy is the number of days with data in year y.

The paper’s abstract describes it as “the average daily ratio of absolute stock return to dollar volume, which is easily obtained from daily stock data for long time series in most stock markets” (Amihud 2002). The quotes here come from the August 2000 working-paper copy; the published Journal of Financial Markets version may differ in wording.

Amihud interprets it as “the daily price response associated with one dollar of trading volume, thus serving as a rough measure of price impact” (Amihud 2002).

The paper relates it to the Amivest liquidity ratio, sum of volume divided by sum of absolute returns, but this is related, not identical (Amihud 2002).

The paper’s regression variable VOLD is the year’s sum of daily share volume times price, divided by 10^3 (Amihud 2002). Equation 1 uses the daily dollar volume without that annual scaling, so the unit convention matters: fix one convention and document it.

The paper’s regressions cover NYSE stocks from 1964 to 1997, and its sample rules go beyond the 150-day test: the stock price must exceed $5 at the end of the prior year, and the 1% tails of ILLIQ are discarded (Amihud 2002).

Why it works from daily data

ILLIQ follows Kyle’s (1985) idea of the price response to order flow, as the paper says. The paper uses daily data because quote data is largely unavailable outside a few markets (Amihud 2002).

Many daily data feeds report volume as a share count. This post’s code assumes shares, multiplies by close to get dollar volume, and leaves the rest of the unit check to you.

Python implementation

The implementation uses pandas pct_change, groupby, and DatetimeIndex.

Worked micro-example, using dollars and close-to-close percent change:

date ticker close volume (shares) dollar volume abs return ratio
2024-01-02 A 100 1,000,000 100,000,000 — —
2024-01-03 A 101 900,000 90,900,000 0.010000 1.100110011e-10
2024-01-04 A 99 800,000 79,200,000 0.019802 2.500250025e-10

The first row has no prior close, so its return is missing and is dropped. The average ratio for the two valid rows is 1.800180018e-10. This ticker-year would be dropped by the 150-day rule.

import numpy as np
import pandas as pd


def amihud_illiq(
    df: pd.DataFrame,
    ticker_col: str = "ticker",
    close_col: str = "close",
    volume_col: str = "volume",
    min_valid_days: int = 150,
) -> pd.DataFrame:
    """Compute yearly Amihud ILLIQ.

    Input
    -----
    df:
        DataFrame with a DatetimeIndex.
    ticker_col:
        Column used as the grouping key.
    close_col:
        Closing price column.
    volume_col:
        Share volume column.

    Return convention
    -----------------
    Daily returns are close-to-close percent changes.

    Dollar-volume convention
    ------------------------
    dollar_vol = close * volume.
    If your source already provides dollar volume, do not double-multiply;
    adapt the dollar-volume line or provide a share-volume column instead.

    Output unit
    -----------
    ILLIQ is average absolute daily return divided by dollar volume traded.
    If dollar volume is in dollars, ILLIQ is return per dollar traded.
    If dollar volume is in millions of dollars, ILLIQ is return per $ million traded.
    The paper scales its regression VOLD by 10^3; do not mix units.

    Admission rule
    --------------
    Keep ticker-years with more than min_valid_days valid return/volume days.
    """
    if not isinstance(df.index, pd.DatetimeIndex):
        raise TypeError("df must have a DatetimeIndex")

    out = df.sort_index().copy()
    out["year"] = out.index.year

    # (a) daily return from close: close-to-close percent change
    out["ret"] = out.groupby(ticker_col)[close_col].pct_change(fill_method=None)

    # (b) dollar volume from share volume
    out["dollar_vol"] = out[close_col] * out[volume_col]

    # (c) drop zero-volume and NaN rows
    out = out.replace([np.inf, -np.inf], np.nan)
    out = out.dropna(subset=["ret", "dollar_vol"])
    out = out[out["dollar_vol"] > 0]

    # (d) daily ratio |ret| / dollar_vol
    out["ratio"] = out["ret"].abs() / out["dollar_vol"]

    # (e) group by ticker and calendar year, average ratio, count valid days
    result = (
        out.groupby([ticker_col, "year"])["ratio"]
        .agg(["mean", "count"])
        .rename(columns={"mean": "ILLIQ", "count": "valid_days"})
        .reset_index()
    )

    # (f) drop ticker-years with <= 150 valid days
    result = result[result["valid_days"] > min_valid_days].copy()

    return result

Synthetic mechanics check (demonstration)

The generator draws a signed order flow with zero mean, so the expected return drift is zero. Each day’s return is noise plus an impact term proportional to flow times dollar volume. Larger impact values produce larger absolute returns per dollar traded, which should raise ILLIQ. This checks the mechanics of the code, not a market effect.

import numpy as np
import pandas as pd


def synthetic_illiq_demo(impact: float, n_days: int = 252, seed: int = 7) -> pd.DataFrame:
    rng = np.random.default_rng(seed)
    dates = pd.bdate_range("2023-01-02", periods=n_days)
    frames = []

    for ticker in ["AAA", "BBB"]:
        dollar_vol = np.exp(rng.normal(loc=14.5, scale=0.5, size=n_days))
        flow = rng.choice([-1.0, 1.0], size=n_days)  # signed order flow, zero mean
        ret = rng.normal(0.0, 0.01, size=n_days) + impact * flow * (dollar_vol / 1e8)
        close = 100.0 * np.cumprod(1.0 + ret)
        volume = dollar_vol / close

        frames.append(
            pd.DataFrame(
                {"ticker": ticker, "close": close, "volume": volume},
                index=dates,
            )
        )

    df = pd.concat(frames, ignore_index=False)
    return amihud_illiq(df)


for impact in [0.5, 1.0, 2.0]:
    illiq = synthetic_illiq_demo(impact)
    print(f"impact={impact}", illiq.groupby("ticker")["ILLIQ"].mean())

Output of the shipped code (mean ILLIQ per ticker, averaged over years, from one run of the demo above):

impact=0.5 ticker
AAA    6.480503e-09
BBB    6.774753e-09
Name: ILLIQ, dtype: float64
impact=1.0 ticker
AAA    1.070150e-08
BBB    1.111037e-08
Name: ILLIQ, dtype: float64
impact=2.0 ticker
AAA    2.031407e-08
BBB    2.089828e-08
Name: ILLIQ, dtype: float64

In this run, mean ILLIQ roughly triples for both tickers as the impact coefficient goes from 0.5 to 2.0. These values are artifacts of the synthetic generator, not estimates for any market.

Interpretation and limits

ILLIQ is a proxy for price impact, not a bid-ask spread. It summarizes daily return response to dollar volume, but it does not observe quoted spreads, order-book depth, intraday timing, or post-trade resilience.

Units matter. If dollar volume is in dollars, ILLIQ is return per dollar traded. If dollar volume is in $ millions, ILLIQ is return per $ million traded. The paper scales its regression VOLD by 10^3, so raw values are not comparable across eras, markets, or data vendors unless the unit convention is identical.

The paper’s qualitative result is that expected illiquidity has a positive effect on expected excess returns over time, with a positive cross-sectional return-illiquidity relation and a stronger relation for small firms (Amihud 2002).

Prefer trade-and-quote (TAQ) based measures when the question is execution cost, spread, depth, or intraday liquidity and when microstructure data are available.

Using it in a strategy

Use ILLIQ as a cross-sectional ranking feature after fixing the unit convention. Control for size and turnover, because the paper’s regressions do (Amihud 2002). Practitioners often winsorize or log-transform the ratio before ranking; the paper itself discards the 1% tails. Re-estimate annually, and do not compare raw ILLIQ values across markets or eras unless the return definition, dollar-volume units, missing-data treatment, and admission rule all match.

FAQ

Is the Amihud ratio a bid-ask spread?

No. It is a daily price-impact proxy built from absolute return and dollar volume, not a spread estimate.

Why multiply volume by price?

Because many feeds report volume as shares, while the formula requires dollar volume. The convention here is dollar_volume = close * volume; check the source’s units before using it (Amihud 2002).

Can I compare ILLIQ across years or markets?

Only if the unit convention, return calculation, dollar-volume construction, missing-data rules, and 150-day admission rule are consistent. Otherwise, differences may reflect data conventions rather than liquidity.

← Back to all posts