famafrench.FamaFrench.queryComp¶
-
FamaFrench.
queryComp
(self, dt_start, dt_end)[source]¶ Query Compustat Fundamentals Annual files from wrds-cloud.
- Parameters
dt_start (datetime.date) – Starting date for the dataset queried or locally retrieved.
dt_end (datetime.date) – Ending date for the dataset queried or locally retrieved.
- Returns
dfcomp (pandas.DataFrame) – Dataset containing Compustat data cleaned from wrds-cloud queries.
dfcomp_list (list, str) – Names of the anomaly portfolio characteristics computed from Compustat Fundamentals Annual.
Note
Following Fama and French:
Book Equity is calculated as follows: book value of stockholders’ equity + balance sheet deferred taxes and investment tax credit (if available) - the book value of preferred stock. Depending on availability, use the redemption, liquidation, or par value (in that order) to estimate the book value of preferred stock ps.
Stockholders’ equity is the value reported by Moody’s or Compustat, if it is available. If not, measure book value of stockholders’ equity as the book value of common equity plus the par value of preferred stock, or the book value of assets minus total liabilities (in that order).
We must flag for number of years in Compustat (less than two years are likely backfilled data)
Note
List of Compustat Fundamentals Annual (XpressFeed) variables:
gvkey : Unique permanent identifier assigned by Compustat at the company-level
datadate : Reporting date for data record
indfmt : Item used to identify whether a company reports in a “Financial Services” or “Industrial” format
datafmt : Item indicating how the company’s data is collected and presented
popsrc : Item indicating whether source of the data is domestic or international
consol : Item used to identify whether a company’s financials represent consolidate or nonconsolidated information
at : Total Assets
lt : Total Liabilities
ceq : Total Common/Ordinary Equity = [Common/Ordinary Stock (Capital) + Capital Surplus/Share Premium Reserve + Retained Earnings - Total Treasury Stock (All Capital)] (= cstk + caps + re - tstk)
seq : Parent’s Stockholders Equity (= ceq + pstk)
pstkrv : Redemption Value of Preferred Stock
pstkl : Liquidating Value of Preferred Stock
pstk : Total Preferred/Preference Stock (Capital) = [Redeemable Preferred/Preference Stock + Nonredeemable Preferred/Preference Stock] (= pstkr + pstkn)
txdb : Deferred Taxes (Balance Sheet)
itcb : Investment Tax Credit (Balance Sheet)
txditc : Deferred Taxes and Investment Tax Credit (= txdb + itcb)
revt : Total Revenue
cogs : Cost of Goods Sold
xint : Total Interest and Related Expense
xsga : Selling, General and Administrative Expense
mib : Non-controlling/Minority Interest (Balance Sheet)
ib : Income Before Extraordinary Items
txdi : Deferred Income Taxes
dp : Depreciation and Amortization
chso : Common Shares Outstanding
adjex_f : Fiscal-Year, Cumulative Adjustment Factor by Ex-Date
act : Total Current Assets
lct : Total Current Liabilities
che : Cash and Short-Term Investments
dlc : Total Debt in Current Liabilities
Note
Depending on a user’s WRDS subscription, data variables will be queried from the most frequently updated Compustat datafiles. Compustat offers daily, monthly, and annually updated files for annual observations. The default datafiles are updated monthly. See wrds-cloud SAS Library Names below:
compd
: dataset Compustat - NA, Bank, Global - Daily Updatecompm
: dataset Compustat - NA - Monthly Updatecompa
: dataset Compustat - NA - Annual Updatecomp
: default dataset Compustat - NA, Bank, Global, Execucomp - Monthly Update