Skip to content

ericma4/EquityCharacteristics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

152 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contact

Version

Academic Background

For financial researches, we need equity characteristics. This repository is a toolkit to calculate asset characteristics in individual equity level and portfolio level.

Prerequisite

  • Read the listed papers
  • WRDS account with subscription to CRSP, Compustat and IBES.
  • Python

Files

Main Files

  • accounting_100_hxz.py -- most annual, quarterly and monthly frequency characteristics
  • functions.py -- impute and rank functions
  • merge_chars.py -- merge all the characteristics from different feather file into one feather file
  • impute_rank_output_bchmk.py -- impute the missing values and standardize raw data
  • iclink.py -- preparation for IBES

Single Characteristic Files

  • beta.py -- 3 months rolling CAPM beta
  • rvar_capm.py, rvar_ff3.py -- residual variance of CAPM and fama french 3 factors model, rolling window is 3 months
  • rvar_mean.py -- variance of return, rolling window is 3 months
  • abr.py -- cumulative abnormal returns around earnings announcement dates
  • myre.py -- revisions in analysts’ earnings forecasts
  • sue.py -- unexpected quarterly earnings
  • ill.py -- illiquidity, rolling window is 3 months
  • maxret_d.py -- maximum daily returns, rolling window is 3 months
  • std_dolvol.py -- std of dollar trading volume, rolling window is 3 months
  • std_turn.py -- std of share turnover, rolling window is 3 months
  • bid_ask_spread.py -- bid-ask spread, rolling window is 3 months
  • zerotrade.py -- number of zero-trading days, rolling window is 3 months

How to use

  1. run accounting_100_hxz.py
  2. run all the single characteristic files (you can run them in parallel)
  3. run merge_chars.py
  4. run impute_rank_output_bckmk.py

Outputs

Data

The date range is 1950 to 2024. The stock universe is top 3 exchanges (NYSE/AMEX/NASDAQ) in US.

The currant time subscript of data is $ret_t \sim chars_{t-1}$

  1. chars_raw_no_impute.feather (all data with original missing value)
  2. chars_raw_imputed.feather (impute missing value with industry median/mean value)
  3. chars_rank_no_imputed.feather (standardize chars_raw_no_impute.feather)
  4. chars_rank_imputed.feather (standardize chars_raw_imputed.feather, and further impute missing values with 0)

Information Variables:

  • stock indicator: gvkey, permno
  • time: datadate, date, year ('datadate' is the available time for data and 'date' is the date of return)
  • industry: sic, ffi49
  • exchange info: exchcd, shrcd
  • return: ret (we also provide original return and return without dividend, you can keep them by modifing impute_rank_output_bchmk.py)
  • market equity: lag_me

Method

Equity Characteristics

This topic is summaried by Green Hand Zhang and Hou Xue Zhang.

Portfolio Characteristics

Portfolio charactaristics is the equal-weighted / value-weighted averge of the characteristics for all equities in the portfolio.

The portfolios includes and not limited to:

Reference

Papers

Many papers contribute a lot to this repository. I am very sorry for only listing the following papers.

Codes

All comments are welcome.

About

Calculate U.S. equity (portfolio) characteristics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.7%
  • Jupyter Notebook 4.3%