Git Product home page Git Product logo

equitycharacteristics's Introduction

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_60_hxz.py -- most annual, quarterly and monthly frequency characteristics
  • functions.py -- impute and rank functions
  • merge_chars.py -- merge all the characteristics from different pickle file into one pickle file
  • impute_rank_output_bchmk.py -- impute the missing values and standardize raw data
  • iclink.py -- preparation for IBES
  • pkl_to_csv.py -- converge the pickle file to csv

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
  • re.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_60_hxz.py
  2. run all the single characteristic files
  3. run merge_chars.py
  4. run impute_rank_output_bckmk.py (you may want to comment the part of sp1500 in this file if you just need the all stocks version)

Outputs

Data

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

The currant time of data is $ret_t = 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.pkl)
  4. chars_rank_imputed.feather (standardize chars_raw_imputed.pkl)

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: me/rank_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.

equitycharacteristics's People

Contributors

xinhe97 avatar ericma4 avatar velonisa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.