Skip to main content

Python access to WRDS Data

Project description

WRDS-Py is a library for extracting data from WRDS data sources and getting it into Pandas. The library allows users to access data from WRDS and extract data using SQL statements. The data that is returned is read into a Pandas data frame.

Installation

Mac OS/Linux

$ python setup.py install

Windows

The WRDS-PY package requires Pandas and Psycopg2. Binaries of these can be found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg

Once the two required packages are installed, you can run $ python setup.py install

For more information please consult the WRDS Support section at https://wrds-web.wharton.upenn.edu/wrds/support/.

Usage

>>> import wrds
>>> db = wrds.Connection()
Enter your credentials.
Username: <your_username>
Password: <your_password>
>>> db.list_libraries()
['audit', 'bank', 'block', 'bvd', 'bvdtrial', 'cboe', ...]
>>> db.list_tables(library='crsp')
['aco_amda', 'aco_imda', 'aco_indfnta', 'aco_indfntq', ...]
>>> db.describe_table(library='crsp', table='stocknames')
Approximately 58957 rows in crsp.stocknames.
       name    nullable              type
0      permno      True  DOUBLE PRECISION
1      permco      True  DOUBLE PRECISION
2      namedt      True              DATE
...
>>> stocknames = db.get_table(library='crsp', table='stocknames', obs=10)
>>> stocknames.head()
   permno  permco      namedt   nameenddt     cusip    ncusip ticker  \
0  10000.0  7952.0  1986-01-07  1987-06-11  68391610  68391610  OMFGA
1  10001.0  7953.0  1986-01-09  1993-11-21  36720410  39040610   GFGC
2  10001.0  7953.0  1993-11-22  2008-02-04  36720410  29274A10   EWST
3  10001.0  7953.0  2008-02-05  2009-08-03  36720410  29274A20   EWST
4  10001.0  7953.0  2009-08-04  2009-12-17  36720410  29269V10   EGAS
>>> db.close()  # Close the connection to the database...
>>> with wrds.Connection() as db:  # You can use a context manager
...    stocknames = db.get_table(library='crsp', table='stocknames', obs=10)
>>> stocknames.head()
   permno  permco      namedt   nameenddt     cusip    ncusip ticker  \
0  10000.0  7952.0  1986-01-07  1987-06-11  68391610  68391610  OMFGA
1  10001.0  7953.0  1986-01-09  1993-11-21  36720410  39040610   GFGC
2  10001.0  7953.0  1993-11-22  2008-02-04  36720410  29274A10   EWST
3  10001.0  7953.0  2008-02-05  2009-08-03  36720410  29274A20   EWST
4  10001.0  7953.0  2009-08-04  2009-12-17  36720410  29269V10   EGAS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrds-3.0.6.tar.gz (10.5 kB view details)

Uploaded Source

Built Distributions

wrds-3.0.6-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

wrds-3.0.6-py2-none-any.whl (11.6 kB view details)

Uploaded Python 2

File details

Details for the file wrds-3.0.6.tar.gz.

File metadata

  • Download URL: wrds-3.0.6.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for wrds-3.0.6.tar.gz
Algorithm Hash digest
SHA256 bfb8425b7a93b8f677373a9b9406bada218537af8ca0bfd42b165dd6fd0585d6
MD5 d3dc057b1f521e84fcd2a9a9894b3979
BLAKE2b-256 0f704ff3acd9c57e13895aa3f232efb6ce3b4448550189870010597108b0d3bc

See more details on using hashes here.

File details

Details for the file wrds-3.0.6-py3-none-any.whl.

File metadata

  • Download URL: wrds-3.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for wrds-3.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5cc3ccaef9c2d656b13137c570a8f45463337ccab3561ccc1a1952d568c47586
MD5 7d1903c30e26c3c2137ab909c432a2ca
BLAKE2b-256 c21c0daee64bf36a7b32e46341902329efa41ecad1230762fe055e389478851b

See more details on using hashes here.

File details

Details for the file wrds-3.0.6-py2-none-any.whl.

File metadata

  • Download URL: wrds-3.0.6-py2-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for wrds-3.0.6-py2-none-any.whl
Algorithm Hash digest
SHA256 7923a64db30930ac687b4b70623cc92555dc68bd5c7d5d0d5696ceb8bf3c9fde
MD5 725762678e8d5ce8fab2fd4e58ceea62
BLAKE2b-256 7b85f42d5344c22e1c47ec4235126f394d6e17b1a25c9eaab88bab990935e969

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page