Capital Asset Pricing Model (CAPM)
CAPM, or the Capital Asset Pricing Model, is a financial model used to estimate the expected return on an investment, such as a stock or portfolio of stocks. It provides a framework for evaluating the risk and return trade-off of an asset or portfolio in relation to the overall market. CAPM is based on the following key components:
- Risk-Free Rate (Rf): This is the theoretical return an investor could earn from an investment with no risk of financial loss. It is typically based on the yield of a government bond.
- Market Risk Premium (Rm - Rf): This 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. It is calculated as the difference between the expected return of the market (Rm) and the risk-free rate (Rf).
- Beta (β): Beta is a measure of an asset’s or portfolio’s sensitivity to market movements. It quantifies how much an asset’s returns are expected to move in relation to changes in the overall market. A beta of 1 indicates that the asset moves in line with the market, while a beta greater than 1 suggests higher volatility, and a beta less than 1 indicates lower volatility.
The Capital Asset Pricing Model (CAPM) is a widely used financial model that helps in determining the expected return of an asset or portfolio based on its systematic risk and the prevailing risk-free rate in the market. CAPM provides insights into how an asset or investment should be priced in order to offer an appropriate rate of return, given its level of risk compared to the overall market.
The formula is as follows:
\[\text{Capital Asset Pricing Model} = \text{Risk Free Rate} + \text{Beta} \cdot (\text{Benchmark Returns} - \text{Risk Free Rate})\]The CAPM here uses the benchmark’s realised return of each period, so the result is the return the asset should have earned given what the market actually did. That makes it a yardstick for Jensen’s Alpha rather than a forward-looking expected return. For a cost of equity, practitioners use an expected market risk premium instead of the realised one (see the Toolkit’s get_market_risk_premium) together with a longer-run Beta. In periods in which the benchmark returns less than the risk-free rate, a high-Beta asset gets a lower required return than a low-Beta one.
See definition: https://en.wikipedia.org/wiki/Capital_asset_pricing_model
Also known as: CAPM, expected return model.
Capital Asset Pricing Model (CAPM) in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_capital_asset_pricing_model as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["JPM", "GS", "MS"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2020-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_capital_asset_pricing_model()
Or, after setting up the Finance Toolkit MCP, ask:
What return did the CAPM require of JPMorgan Chase, Goldman Sachs and Morgan Stanley in each year from 2021 to 2025?
Which returns:
| Date | JPM | GS | MS |
|---|---|---|---|
| 2021 | 0.2426 | 0.2808 | 0.3177 |
| 2022 | -0.1567 | -0.173 | -0.1915 |
| 2023 | 0.2334 | 0.276 | 0.3055 |
| 2024 | 0.2077 | 0.28 | 0.2632 |
| 2025 | 0.1702 | 0.221 | 0.2174 |
Parameters
get_capital_asset_pricing_model 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" |
rolling | int | The rolling window size to use for the Beta component of the calculation. If set, Beta is estimated over a rolling window of this many periods across the full return history instead of per period. Defaults to None. | 4 |
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 |
growth | bool | Whether to calculate the growth of the ratios. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |