quant.barra

基类

class quant.barra.factors.Descriptor[源代码]

Methods

B2P quant.barra.factors.book_to_price.BToP 的别名
BLEV Book leverage
Beta quant.barra.factors.beta.BetaDescriptor 的别名
CETOP quant.barra.factors.earnings_yield.CEToP 的别名
CMRA() Cumulative range
DASTD() Daily standard deviation
DTOA quant.barra.factors.leverage.DToA 的别名
EGRLF Long-term predicted earnings growth
EGRO Earnings growth (trailing five years)
EGRSF Short-term predicted earnings growth
EPFWD Predicted earnings-to-price ratio
ETOP quant.barra.factors.earnings_yield.EToP 的别名
HSigma() Historical sigma
LD Long-term debt
LnCap Natural log of market cap
MLEV Market leverage
NLSize Cube of Size
RSTR Relative strength
STOA() Share turnover, trailing 12 months
STOM() Share turnover, one month
STOQ() Share turnover, trailing 3 months
get_raw_value() 返回原始值。需重载此方法
get_zscore() 返回zscore
register(name) 注册一个Descriptor,注册以后可以通过Descriptor.xxx来引用这个类
get_raw_value() → pandas.core.frame.DataFrame[源代码]

返回原始值。需重载此方法

get_zscore() → pandas.core.frame.DataFrame[源代码]

返回zscore

classmethod register(name)[源代码]

注册一个Descriptor,注册以后可以通过Descriptor.xxx来引用这个类

class quant.barra.factors.Factor(name, descriptors, weights, disentangle=None)[源代码]

Methods

get_exposures([fillna]) 返回每只股票每天在该因子上的暴露
get_factors() 返回所有已注册的因子
get_exposures(fillna=True) → pandas.core.frame.DataFrame[源代码]

返回每只股票每天在该因子上的暴露

classmethod get_factors() → dict[源代码]

返回所有已注册的因子

Returns:
dict: key:因子名,value:因子对象

Descriptor

Beta

class quant.barra.factors.beta.BetaDescriptor

Beta

Computed as the slope coefficient in a time-series regression of excess stock return, \(r_t - r_{ft}\), against the cap-weighted excess return of the estimation universe \(R_t\),

\[r_t-r_{ft} = \alpha + \beta R_t + e_t\]

The regression coefficients are estimated over the trailing 252 trading days of returns with a half-life of 63 trading days.

RSTR

class quant.barra.factors.momentum.RSTR

Relative strength

Computed as the sum of excess log returns over the trailing T = 504 trading days with a lag of L=21 tradingdays,

\[RSTR = \Sigma_{t=L}^{T+L}w_t[ln(1+r_t)-ln(1+r_{ft})]\]

where \(r_t\) is the stock return on day t, \(r_{ft}\) is the risk-free return, and \(w_t\) is an exponential weight with a half-life of 126 trading days.

LnCap

class quant.barra.factors.size.LnCap

Natural log of market cap

Given by the logarithm of the total market capitalization of the firm.

BToP

class quant.barra.factors.book_to_price.B2P

Book-to-price ratio

Last reported book value of common equity divided by current market capitalization.

EPFWD

class quant.barra.factors.earnings_yield.EPFWD

Predicted earnings-to-price ratio

Given by the 12-month forward-looking earnings divided by the current market capitalization. Forward-looking earnings are defined as a weighted average between the average analyst-predicted earnings for the current and next fiscal years.

CEToP

class quant.barra.factors.earnings_yield.CEToP

Cash earnings-to-price ratio

Given by the trailing 12-month cash earnings divided by current price.

EToP

class quant.barra.factors.earnings_yield.EToP

Trailing earnings-to-price ratio

Given by the trailing 12-month earnings divided by the current market capitalization. Trailing earnings are defined as the last reported fiscal-year earnings plus the difference between current interim figure and the comparative interim figure from the previous year.

EGRLF

class quant.barra.factors.growth.EGRLF

Long-term predicted earnings growth

Long-term (3-5 years) earnings growth forecasted by analysts.

EGRSF

class quant.barra.factors.growth.EGSRLF

Short-term predicted earnings growth

Short-term (1 year) earnings growth forecasted by analysts.

EGRO

class quant.barra.factors.growth.EGSRO

Earnings growth (trailing five years)

Annual reported earnings per share are regressed against time over the past five fiscal years. The slope coefficient is then divided by the average annual earnings per share to obtain the earnings growth.

MLEV

class quant.barra.factors.leverage.MLEV

Market leverage

Computed as MLEV = (ME + PE + LD) / ME where ME is the market value of common equity on the last trading day, PE is the most recent book value of preferred equity, and LD is the most recent book value of long-term debt.

BLEV

class quant.barra.factors.leverage.BLEV

Book leverage

Computed as BLEV = (BE + PE + LD) / ME where BE is the book value of common equity on the last trading day, PE is the most recent book value of preferred equity, and LD is the most recent book value of long-term debt.

DToA

class quant.barra.factors.leverage.DToA

Debt-to-assets

Computed as

\[DTOA = TD / TA\]

where TD is the book value of total debt (long-term debt and current liabilities), and TA is most recent book value of total assets.

STOM

class quant.barra.factors.liquidity.STOM

Share turnover, one month

Computed as the log of the sum of daily turnover during the previous 21 trading days,

\[STOM = ln[\Sigma_{t=1}^{21}\frac{V_t}{S_t}]\]

where Vt is the trading volume on day t , and St is the number of shares outstanding.

STOQ

class quant.barra.factors.liquidity.STOQ

Share turnover, trailing 3 months

Let STOM_t be the share turnover for month t , with each month consisting of 21 trading days. The quarterly share turnover is defined by

\[STOQ = ln[\frac{1}{T}\Sigma_{t=1}{T}exp\{STOM_t\}]\]

where T = 3 months.

STOA

class quant.barra.factors.liquidity.STOA

Share turnover, trailing 12 months

Let STOM_t be the share turnover for month t , with each month consisting of 21 trading days. The quarterly share turnover is defined by

\[STOQ = ln[\frac{1}{T}\Sigma_{t=1}{T}exp\{STOM_t\}]\]

where T = 12 months.

NLSize

DASTD

CMRA

HSigma

Factors

Beta

\[Beta = 1.0 * BetaDescriptor\]

BookToPrice

\[BookToPrice = 1.0 * BToP\]

EarningsYield

\[EarningsYield = 0.68 * EPFWD + 0.21 * CEToP + 0.11 * EToP\]

Growth

\[Growth = 0.18 * EGRLF + 0.11 * EGRSF + 0.24 * EGRO + 0.47 * SGRO\]

Leverage

\[Leverage = 0.38 * MLEV + 0.35 * DToA + 0.27 * BLEV\]

Liquidity

\[Liquidity = 0.35 * STOM + 0.35 * STOQ + 0.30 * STOA\]

Momentum

\[Momentum = 1.0 * RSTR\]

NonLinearSize

\[NonLinearSize = 1.0 * NLSize\]

ResidualVolatility

\[ResidualVolatility = 0.74 * DASTD + 0.16 * CMRA + 0.10 * HSigma\]

Size

\[Size = 1.0 * LnCap\]