Introduction to WRDS

Table of Contents

1 Facts: empirical research and data

1.1 Empirical research

publication.png

1.2 Popular data in finance

popdata.png

1.3 Where to find data

WRDS

2 What is WRDS?

Wharton Research Data Service

website.png

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

concept1.png

concept2.png

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

intro_to_wrds_358b28cab84aac0d9652ca43b3ce6d147eee578b.png

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

adjprc.png

  • Need another two variables to adjust stock price
    • ajexdi: adjusted factor
    • trfd: return factor

intro_to_wrds_3afcede792aa226ae97a5cdc6fba69caf39385b9.png

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)

cusip_error.png

6 Help

Created: 2019-11-17 Sun 14:21