libb.beta

beta(x, index)[source]

Compute beta of x with respect to index (typically over returns).

Parameters:
  • x – Asset returns.

  • index – Index returns.

Returns:

Beta coefficient.

Return type:

float

Example:

>>> x = [0.10, 0.18, -0.15, 0.18]
>>> y = [0.10, 0.17, -0.17, 0.17]
>>> '{:.2}'.format(beta(x, y))
'0.97'