Bull and Bear Beta

Calculate the bull and bear market Beta and Alpha and the Timing Ratio of an investment portfolio or asset: the CAPM regression fitted separately over the days the market rose (bull) and fell (bear).

The formulas are as follows:

\[\text{Excess Return} = \text{Bull Alpha} + \text{Bull Beta} \cdot \text{Benchmark Excess Return},\;\; \text{over the days the market rose}\] \[\text{Excess Return} = \text{Bear Alpha} + \text{Bear Beta} \cdot \text{Benchmark Excess Return},\;\; \text{over the days the market fell}\] \[\text{Timing Ratio} = \frac{\text{Bull Beta}}{\text{Bear Beta}}\] \[\text{Annualized Alpha} = (1 + \text{Alpha per Day})^{P} - 1\]

Where the excess returns are the daily returns minus the risk free rate, the market “rose” when the benchmark excess return was positive (PerformanceAnalytics) or, with the return market, when the benchmark return was positive (empyrical), and P is the number of days in a year (252, 365 for a ticker that trades on weekends). A Timing Ratio above 1 means the asset moved more with the market when it rose than when it fell, the asymmetry a successful market timer shows; Henriksson and Merton (1981) test the same asymmetry with one regression (see the Henriksson-Merton model of get_market_timing_model).

Also known as: up-market and down-market beta, conditional beta, up and down alpha.

Example · XLU, XLK · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_bull_bear_beta:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["XLU", "XLK"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.performance.get_bull_bear_beta().xs("XLK", level=0, axis=1)

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

What were the alpha and beta of the Technology Select Sector SPDR (XLK) in rising and falling markets in each year from 2021 to 2025, and its timing ratio?

Which returns:

Parameters

get_bull_bear_beta accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."weekly"
marketstrWhat splits the bull and bear days. Options are: “excess_return” (the sign of the benchmark excess return, PerformanceAnalytics), “return” (the sign of the benchmark return, empyrical). Defaults to “excess_return”."excess_return"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Henriksson, R.D., & Merton, R.C. (1981). “On Market Timing and Investment Performance II: Statistical Procedures for Evaluating Forecasting Skills.” Journal of Business, 54(4), 513-533.
  • Paper Bacon, C.R. (2008). “Practical Portfolio Performance Measurement and Attribution.” 2nd edition, John Wiley & Sons.
  • Library Referenced against PerformanceAnalytics (R)’s CAPM.beta.bull
  • Library Referenced against PerformanceAnalytics (R)’s CAPM.beta.bear
  • Library Referenced against PerformanceAnalytics (R)’s TimingRatio
  • Library Referenced against empyrical’s up_alpha_beta
  • Library Referenced against empyrical’s down_alpha_beta
Share