Calculate Carhart Four Factor model scores for a set of financial assets.

The Carhart Four Factor model extends the Fama and French Three Factor model with a momentum factor, based on the observation that stocks with high prior returns (winners) tend to keep outperforming stocks with low prior returns (losers) over the medium term:

  • Market Risk Premium (Mkt-RF): The excess return of the market over the risk-free rate.
  • Size Premium (SMB): The historical excess return of small-cap stocks over large-cap stocks.
  • Value Premium (HML): The historical excess return of value stocks over growth stocks.
  • Momentum (MOM): The historical excess return of prior winner stocks over prior loser stocks.

The model performs a Multi Linear Regression on all four factors and defines the regression parameters for each asset over time based on its exposure to these factors:

  • Excess Return = Intercept + Beta1 * Mkt-RF + Beta2 * SMB + Beta3 * HML + Beta4 * MOM + Residuals

For more information about the method, see the following paper:

  • Carhart, M.M. (1997). “On Persistence in Mutual Fund Performance.” The Journal of Finance, 52(1), 57-82.

Also known as: Carhart model, four-factor model, momentum-augmented Fama-French model.

Carhart Four-Factor Model in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_carhart_four_factor_model as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.performance.get_carhart_four_factor_model(period="quarterly")["AMZN"]

Parameters

The function accepts the following parameters:

  • period (str, optional): The period for the calculation (e.g., “weekly”, “monthly”, “quarterly”, “yearly”). Defaults to “quarterly” if the Toolkit is initialized with quarterly=True, otherwise “yearly”.
  • rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the ratio values. Defaults to False.
  • lag (int or list of int, optional): The lag to use for the growth calculation. Defaults to 1.
  • 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.
  • show_columns (list of str, optional): Restrict the result to these top level columns. Defaults to None, which returns every column.
Share