Factor Correlations
Calculates factor correlations between each factor. This is useful to understand how correlated each factor is to each other. This is based off the Fama and French 5 Factor model which includes:
- Market Risk Premium (Mkt-RF): Represents the additional return that investors expect to earn for taking on the risk of investing in the overall market as opposed to a risk-free asset.
- Size Premium (SMB): Reflects the historical excess return of small-cap stocks over large-cap stocks.
- Value Premium (HML): Captures the historical excess return of value stocks over growth stocks.
- Profitability (RMW): Measures the historical excess return of high profitability stocks over low profitability stocks.
- Investment (CMA): Quantifies the historical excess return of low investment stocks over high investment stocks.
Optionally, it is also possible to see the correlation between the risk-free rate and each factor.
The formula is as follows:
\[\text{Factor Correlation} = \text{Pearson Correlation} (\text{Daily Factor}\; A \;\text{Return},\; \text{Daily Factor}\; B \;\text{Return}),\;\; \text{using the daily Fama and French 5 Factor returns within each period (e.g. each year)}\]Also known as: factor model correlations.
Factor Correlations in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_factor_correlations as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["SPY"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
benchmark_ticker=None,
)
toolkit.performance.get_factor_correlations()
Or, after setting up the Finance Toolkit MCP, ask:
How did the daily returns of the five Fama and French factors correlate with each other in 2025?
Which returns:
| Mkt-RF | SMB | HML | RMW | CMA | |
|---|---|---|---|---|---|
| (‘2025’, ‘Mkt-RF’) | 1 | 0.1744 | -0.3814 | -0.4273 | 0.0586 |
| (‘2025’, ‘SMB’) | 0.1744 | 1 | 0.2143 | -0.2924 | 0.2143 |
| (‘2025’, ‘HML’) | -0.3814 | 0.2143 | 1 | 0.3573 | 0.2218 |
| (‘2025’, ‘RMW’) | -0.4273 | -0.2924 | 0.3573 | 1 | 0.0657 |
| (‘2025’, ‘CMA’) | 0.0586 | 0.2143 | 0.2218 | 0.0657 | 1 |
Parameters
get_factor_correlations accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "quarterly" |
factors_to_calculate | list of str | List of factors to calculate scores and residuals for. Defaults to [“Mkt-RF”, “SMB”, “HML”, “RMW”, “CMA”]. | ["Mkt-RF", "SMB", "HML"] |
exclude_risk_free | bool | Whether to exclude the risk-free rate from the results. Defaults to True. | False |
region | str | The region whose factors to use: “United States”, “Developed”, “Developed ex US”, “Europe”, “Japan”, “Asia Pacific ex Japan” or “North America” (the factors of Ken French’s library for that region’s stocks). Every region’s factors are U.S. dollar returns with the U.S. one-month Treasury bill as the risk-free rate (RF). Defaults to “United States”. | "Europe" |
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 |