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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wrds-3.0.8.tar.gz
.
File metadata
- Download URL: wrds-3.0.8.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/36.2.7 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94f44b8661d16e22932bc8dfbe3435380799ba06ca642698ae27471d81a0f6c4 |
|
MD5 | a9dc1c585c1f036daef41c0eafd7daa6 |
|
BLAKE2b-256 | a803493096903ec08e392c15df645fcf9a1d94d2e36582061972f109aa4c7d44 |
File details
Details for the file wrds-3.0.8-py3-none-any.whl
.
File metadata
- Download URL: wrds-3.0.8-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/36.2.7 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85afbf88c4abf65072ee00cf534a9c689d51afc90d81ffba6205028449c70017 |
|
MD5 | 16fc2ba7f4eb66a1be6a654e530cfbdf |
|
BLAKE2b-256 | 1c359d86097c36a8528a1f5bbc3815c161c2dfce7fffc28e10cfd7c9726c1ac0 |