Skip to content

Capital Asset Pricing Model (CAPM) API

Capital Asset Pricing Model (CAPM) implementation.

capm(risk_free_rate, beta, market_return)

Calculate expected return using the Capital Asset Pricing Model (CAPM).

CAPM formula: E(R) = Rf + β × (Rm - Rf)

This implementation supports both scalar and vector inputs for batch calculations.

Parameters:

Name Type Description Default
risk_free_rate float or array - like

Risk-free rate of return (e.g., 0.03 for 3%)

required
beta float or array - like

Beta of the asset(s) (measure of systematic risk)

required
market_return float or array - like

Expected market return (e.g., 0.08 for 8%)

required

Returns:

Type Description
dict or list of dict

Expected return and components for each asset

Raises:

Type Description
ValueError

If any of the input parameters are invalid