API Reference¶
This is a comprehensive reference for everything you get when you import famafrench
.
Table of Contents
FamaFrench
Constructor¶
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. |
wrdsConnection
Constructor¶
Class for setting up the remote connection to wrds-cloud; largely builds on the |
Connecting to wrds-cloud
¶
|
Make a connection to the wrds-cloud database. |
|
Close the connection to the database. |
|
Create a |
|
Query the wrds-cloud database using a raw SQL string. |
wrds-cloud
Query Tools¶
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. |
Estimating Market Betas and Rolling Residual Variances¶
Estimate factor-based quantities of risk (specifically, market betas) as well as residuals using rolling regressions. |
Constructing Portfolios and Return-Based Factors¶
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. |
Comparing to Ken French’s Online Library¶
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. |
Summary Statistics and Diagnostics¶
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 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. |
Auxiliary Functions and Utilities¶
Wrapper for |
|
Directly download (from Ken French’s online library) zipped monthly or annual datafiles for the Short-Term Reversal or Long-Term Reversal Fama-French-style factors. |
|
Wrapper for class instance methods enabling the timing of execution. |
|
Boolean variable that is |
|
Consistent w/ Fama and French (2008, 2016), map the prior (j-k) monthly return strategy into a daily strategy (see Ken French’s online documentation). |
|
Calculate (net) weighted portfolio return for portfolio with weights |
|
Compute a simple average across different columns. |
|
Construct detailed tables with summary statistics. |