Skip to content

Latest commit

 

History

History
150 lines (126 loc) · 3.42 KB

intro_to_wrds_presentation.org

File metadata and controls

150 lines (126 loc) · 3.42 KB

Introduction to WRDS

1 Facts: empirical research and data

1.1 Empirical research

./png/publication.png

1.2 Popular data in finance

./png/popdata.png

1.3 Where to find data

WRDS

2 What is WRDS?

Wharton Research Data Service

./png/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

./png/concept1.png

./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

exchcdstock exchange
1NYSE
2AMEX
3NASDAQ

5.1.3 shrcd: share code

shrcdshare type
10common shares
11common 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

$$\text{market value} = \left|prc\right| × shrout$$

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
ficName
GBRUnited Kingdom
DEUGermany

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

./png/adjprc.png

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

$$\text{adjusted price} = \frac{prccd}{ajexdi} × trfd$$

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

Two problems if you download data in Excel:

  • Missing leading zeros
  • Scientific notation (E-notation)

./png/cusip_error.png

6 Help