Introduction to WRDS
Table of Contents
1 Facts: empirical research and data
1.1 Empirical research
1.2 Popular data in finance
1.3 Where to find data
WRDS
2 What is WRDS?
Wharton Research Data Service
3 How to access
- WRDS website
- X-WRDS connection
- Unix (not open to master students)
3.1 WRDS website
https://wrds-www.wharton.upenn.edu/
- User friendly interface
- Easy to use
3.2 X-WRDS connection
- What is X?
- Python
- R
- SAS
- Stata
- Need knowledge of computer language or software skills
3.3 Unix
- Need to know some Unix commands
4 How to search data
- Concept
5 Demo
- CRSP
- Compustat
5.1 Understand CRSP
5.1.1 Overview
- USA
- 1925 to 2018
- stock price, volume, number of shares, …
5.1.2 exchcd
: stock exchange code
exchcd | stock exchange |
---|---|
1 | NYSE |
2 | AMEX |
3 | NASDAQ |
5.1.3 shrcd
: share code
shrcd | share type |
---|---|
10 | common shares |
11 | common shares |
5.1.4 prc
: stock price
- Negative stock price
- Take absolute value to convert negative price to positive
5.1.5 Market value
market value = stock price * number of shares
5.2 Understand Compustat
5.2.1 Overview
- Compustat North Amercia (NA)
- USA and Canada
- Fundamental Annual: accounting information
- Security Daily/Monthly: stock price
- Compustat Global
- China, France, Nigeria, Thailand, UK, …
- Fundamental Annual: accounting information
- Security Daily: stock price
5.2.2 Compustat-security daily/monthly
tpci
: share type- tpci = 0: common shares
fic
: country code
fic | Name |
---|---|
GBR | United Kingdom |
DEU | Germany |
Country code list: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
prccd
: unadjusted closing price- Unadjusted stock price cannot reflect true performance of stock return
- Need to adjust stock price before calculating stock return
- Need another two variables to adjust stock price
ajexdi
: adjusted factortrfd
: return factor
5.3 Download data from WRDS website
- In class demo.
5.4 Download data by Python-WRDS
import pandas as pd import wrds conn = wrds.Connection() crsp = conn.raw_sql(""" select permno, date, ret, abs(prc) as price_adj, shrout from crsp.msf where exchcd between 1 and 3 and shrcd between 10 and 11 and date>='2015-01-01' """)
5.5 The problem of Excel
There are two problems if you download data in Excel:
- Missing leading zeros
- Scientific notation (E-notation)
6 Help
- My email: p.li@leeds.ac.uk
- My Github: https://github.com/mk0417