Skip to main content

Access WRDS data through PostgreSQL in Python.

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

For detailed information on installation of the module, please see PYTHON: From Your Computer (Jupyter/Spyder)

Using pip

The easiest way to install WRDS-Py on any supported platform is to use pip, the Python package manager, to install from the Python package index (pypi).

$ pip install wrds

Windows

WRDS-Py requires the Pandas and Psycopg2 Python packages. Binaries of these can be found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg

Once the two required packages are installed, use pip to install.

Usage

For detailed information on use of the module, please see Querying WRDS Data using Python

>>> 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-0.0.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

wrds-0.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wrds-0.0.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for wrds-0.0.0.tar.gz
Algorithm Hash digest
SHA256 6237179b42a8a85f5af76987e036f7f2195cb6d6430af9d44f9f76a0d1cc6511
MD5 a371d48d3c73f9d8cba914a2e0fbb758
BLAKE2b-256 5d5367f8d04cabca132af15c4a7bf469bc9ad4031df9ebe06bb35324a82e0e1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wrds-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for wrds-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a20850779862d9525fa5243ca00ceb86365b15de6c3b33f79bc095f916f08268
MD5 c71c06d699b9261b10bf4ebc3c45ff68
BLAKE2b-256 ef06ee2b853e9beab740934a2388811391f4c0c21d31096ce985e7127c3d61e8

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