famafrench.FamaFrench¶
-
class
famafrench.FamaFrench(pickled_dir, runQuery, freqType, sortCharacsId, factorsId, mainCharacsId=None, runEstimation=False)[source]¶ Class providing tools for constructing and replicating datasets from Ken French’s online library via queries to CRSP, Compustat Fundamentals Annual, and other sources accessed through wrds-cloud.
-
runQuery¶ Flag for choosing whether to query datafiles from wrds-cloud or import locally-pickled files.
- Type
-
freqType¶ Observation frequency of the portfolios. Possible choices are
D: dailyW: weeklyM: monthlyQ: quarterly (3-months)A: annual
- Type
-
sortCharacsId¶ Names of the anomaly characteristics used for portfolio sorting. The list will contain one, two, or three elements. The order of the elements matters and should be consistent w/ the orders presented in Ken French’s online library. Possible choices are:
ME: SizeBE: Book equityBM: Book-to-Market equityOP: Operating ProfitabilityINV: InvestmentEP: Earnings/PriceCFP: Cashflow/PriceDP: Dividend Yield (i.e. Dividends/Price)PRIOR_2_12: Prior (2-12) ReturnsPRIOR_1_1: Prior (1-1) ReturnsPRIOR_60_13: Prior (13-60) ReturnsAC: AccrualsBETA: Market Beta (estimated using the Scholes-Williams (1977) methodology)VAR: Variance (Daily and calculated using last 60 days (w/ 20 minimum)RESVAR: Fama-French Three-factor model Residual Variance (Daily and calculated using last 60 days (w/ 20 minimum)NI: Net Share Issues
-
factorsId¶ Names of the anomaly/risk-based factors following Fama and French (1992, 1993, 2008, 2015, 2017). Possible choices are:
MKT-RF: Market premiumSMB: Small Minus BigHML: High Minus LowRMW: Robust Minus WeakRMWc: Cash-based Robust Minus Weak (Todo)CMA: Conservative Minus AggressiveMOM: Momentum - based on Prior (2-12) returnsST_Rev: Short-Term Reversal - based on Prior (1-1) returnsLT_Rev: Long-Term Reversal - based on Prior (13-60) returns
-
mainCharacsId¶ Names of the anomaly characteristics computed as averages for each portfolio bucket and constructed using the list
sortCharacsId. If None,mainCharacsIis set to the listsortCharacsId.
-
runEstimation¶ Flag for choosing whether to run any estimation procedures for the first time/re-estimate procedures by querying wrds-cloud datafiles or import locally-pickled files storing existing estimates.
- Type
bool, default False
-
(Auxiliary) Methods/Attributes
Query Compustat Fundamentals Annual files from wrds-cloud. |
|
Query CRSP Stock/Security files from wrds-cloud. |
|
Query CRSP’s Stock Event - Delisting files on wrds-cloud. |
|
Query the risk-free interest rate (ie 1-month Treasury Bill rate) from wrds-cloud. |
|
Calculate rolling daily variance of stock returns for all CRSP stocks queried from wrds-cloud. |
|
Aggregate market value of equity me for cases in which the same firm (ie single permco identifer) has two or more securities (ie multiple permno identifiers) for a given date. |
|
Construct market value of equity me for Decemeber of every year. |
|
Construct market value of equity me for June of every year. |
|
Query the CRSP/Compustat (CCM) Merged Linking Table needed to merge CRSP securities to Compustat companies on (permno, gvkey) identifier pairs. |
|
Estimate factor-based quantities of risk (specifically, market betas) as well as residuals using rolling regressions. |
Primary Methods/Attributes
Select NYSE stocks used in the construction of breakpoints (ie thresholds) for portfolio sorting. |
|
Generalized routine used to construct datasets containing portfolio returns (which may include factor returns), number of firms in each portfolio, or average anomaly portfolio characteristics at a given frequency and for a given sample period. |
|
Construct dataset w/ portfolio returns (which may include factor returns) at a given frequency and for a given sample period. |
|
Construct dataset w/ number of firms in each portfolio at a given frequency and for a given sample period. |
|
Construct average anomaly portfolio characteristics at a given frequency and for a given sample period. |
|
Construct dataset w/ Fama-French-style factors at a given frequency and for a given sample period. |
|
Detailed summary statistics tables of portfolio returns (which may include factor returns), number of firms in each portfolio, or average anomaly portfolio characteristics at a given frequency and for a given sample period. |
|
Generalized routine used to query datasets from Ken French’s online library at a given frequency and for a given sample period. |
|
Query portfolio returns from Ken French’s online library at a given frequency and for a given sample period. |
|
Query number of firms in each portfolio from Ken French’s online data library at a given frequency and for a given sample period. |
|
Query average anomaly portfolio characteristics from Ken French’s online library at a given frequency and for a given sample period. |
|
Query Fama-French-style factors from Ken French’s online library at a given frequency and for a given sample period. |
|
Generalized routine used to compare datasets constructed from wrds-cloud queries to their equivalents made publicly available on Ken French’s online library at a given frequency and for a given sample period. |