WRDS
Wharton Research Data Service
- WRDS website
- X-WRDS connection
- Unix (not open to master students)
https://wrds-www.wharton.upenn.edu/
- User friendly interface
- Easy to use
- What is X?
- Python
- R
- SAS
- Stata
- Need knowledge of computer language or software skills
- Need to know some Unix commands
- Concept
- CRSP
- Compustat
- USA
- 1925 to 2018
- stock price, volume, number of shares, …
exchcd | stock exchange |
---|---|
1 | NYSE |
2 | AMEX |
3 | NASDAQ |
shrcd | share type |
---|---|
10 | common shares |
11 | common shares |
- Negative stock price
- Take absolute value to convert negative price to positive
market value = stock price * number of shares
- 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
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
- In class demo.
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'
""")
Two problems if you download data in Excel:
- Missing leading zeros
- Scientific notation (E-notation)
- My email: p.li@leeds.ac.uk
- My Github: https://github.com/mk0417