Financial Research Data Services
Project description
FRDS - Financial Research Data Services
frds is a Python framework that aims to provide the simplest way to compute a collection of major academic measures used in the finance literature, one-click with a Graphical User Interface (GUI).
Supported Measures
The built-in measures currently supported by frds are as below. New measures will be added to frds gradually and can be easily developed following a template shown in Developing New Measures.
Firm Characteristics
- Accounting Restatements
- Number of various accounting restatements during the past (n) fiscal year.
- Source:
wrds.comp.funda,wrds.audit.auditnonreli.
- Asset Tangibility
- Property, Plant and Equipment (Net) scaled by total assets.
- Source:
wrds.comp.funda.
- Board Independence
- Board size and independence measured as the ratio of independent board members to board size.
- Source:
wrds.funda,wrds.boardex.na_wrds_company_profile,wrds.boardex.na_wrds_org_composition.
- Book Leverage
- Amount of debts scaled by the firm's total debts plus common equity.
- Source:
wrds.comp.funda.
- Capital Expenditure
- Capital expenditures scaled by total assets.
- Source:
wrds.comp.funda.
- Credit Rating
- S&P credit rating.
- Source:
wrds.ciq.erating,wrds.ciq.gvkey.
- Executive Ownership
- Various measures of executive stock ownership.
- Source:
wrds.comp.funda,wrds.execcomp.anncomp.
- Firm Size
- Natural logarithm of total assets.
- Source:
wrds.comp.funda.
- Market-to-Book Ratio
- Market value of common equity to book value of common equity.
- Source:
wrds.comp.funda.
- ROA
- Income before extraordinary items scaled by total assets.
- Source:
wrds.comp.funda.
- ROE
- Income before extraordinary items scaled by common equity.
- Source:
wrds.comp.funda.
- Stock Delisting
- Stocks delisted due to financial troubles or as a result of being merged.
- Source:
wrds.crsp.dse.
Bank Holding Company (BHC) Characteristics
- BHC Size
- Natural logarithm of total assets.
- Source:
frb_chicago.bhc.bhcf.
- BHC Loan Growth
- Natural logarithm of total loans in the current quarter divided by the total loans in the previous quarter.
- Source:
frb_chicago.bhc.bhcf. - Referece: Zheng (2020 JBF).
- BHC FX Exposure
- Fee and interest income from loans in foreign offices (BHCK4059) scaled by total interest income (BHCK4107).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC NetIncome/Assets
- Net income (BHCK4340) / total assets (BHCK2170).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC Dividend/Assets
- Cash dividends on common stock (BHCK4460) / total assets (BHCK2170).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC RegulatoryCapital/Assets
- Total qualifying capital allowable under the risk-based capital guidelines (BHCK3792) normalized by risk-weighted assets (BHCKA223).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC Tier1Capital/Assets
- Tier 1 capital allowable under the risk-based capital guidelines (BHCK8274) normalized by risk-weighted assets (BHCKA223).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC Gross IR Hedging
- Total gross notional amount of interest rate derivatives held for purposes other than trading (BHCK8725) over total assets (BHCK2170); for the period 1995 to 2000, contracts not marked to market (BHCK8729) are added.
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC Gross FX Hedging
- Total gross notional amount of foreign exchange rate derivatives held for purposes other than trading (BHCK8726) over total assets (BHCK2170); for the period 1995 to 2000, contracts not marked to market (BHCK8730) are added.
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
- BHC Maturity Gap & Narrow Maturity Gap
- Maturity gap is defined as the earning assets that are repriceable or mature within one year (BHCK3197) minus interest-bearing deposits that mature or reprice within one year (BHCK3296) minus long-term debt that reprices or matures within one year (BHCK3298 + BHCK3409) minus variable rate preferred stock (BHCK3408) minus other borrowed money with a maturity of one year or less (BHCK2332) minus commercial paper (BHCK2309) minus federal funds and repo liabilities (BHDMB993 + BHCKB995), normalized by total assets.
- Narrow maturity gap does not subtract interest-bearing deposits that mature or reprice within one year (BHCK3296).
- Source:
frb_chicago.bhc.bhcf. - Reference: Rampini, Viswanathan and Vuillemey (2020 JF).
Installation & Configuration
frds requires Python3.8 or higher. To install using pip:
$ pip install frds
After installation, a folder frds will be created under your user's home directory, which contains a data folder, a result folder and a default configuration file config.ini:
[Paths]
base_dir: ~/frds
data_dir: ${base_dir}/data
result_dir: ${base_dir}/result
[Login]
wrds_username:
wrds_password:
You need to enter your WRDS username and password under the login section.
Usage
To start estimating various measures, run frds as a module:
$ python -m frds.gui.run
Alternatively, run without GUI to estimate all measures with default parameters:
$ python -m frds.run
You can also use the following example to use frds programmatically.
from frds import Professor
from frds.measures import AccountingRestatement, ROA, FirmSize
measures = [
AccountingRestatement(years=1),
AccountingRestatement(years=2),
ROA(),
FirmSize(),
]
config = dict(
wrds_username="your_wrds_username",
wrds_password="you_wrds_password",
result_dir="path/to/where/you/want/to/store/the/result/",
data_dir="path/to/where/you/want/to/store/the/data/",
)
if __name__ == "__main__":
with Professor(config=config) as prof:
prof.calculate(measures)
The output data will be saved as STATA .dta file in the result folder.
For example, below is a screenshot of the output for frds.measures.AccountingRestatement.
Developing New Measures
New measures can be easily added by subclassing frds.measures.Measure and
implement the estimate function, as shown in the template below. The best working example would be frds.measures.ROA.
from typing import List
import numpy as np
import pandas as pd
from frds.measures import Measure
from frds.data import Dataset
DATASETS_REQUIRED = [
Dataset(source='wrds',
library="comp",
table="funda",
vars=[
"datadate",
"gvkey",
"at",
"ib",
],
date_vars=["datadate"],
)
]
VARIABLE_LABELS = {}
class NewMeasure(Measure):
def __init__(self):
# Note: `name` will be used to name the result dataset.
# So this will lead to a `New Measure.dta` in the `result` folder.
# If the new measure contains custom parameters, please also implement
# the `__str__()` function to differentiate
super().__init__(name="New Measure", datasets_required=DATASETS_REQUIRED)
def estimate(self, nparrays: List[np.recarray]):
# do something with nparrays and produce a `result` pandas DataFrame
# ...
assert isinstance(result, pd.DataFrame)
return result, VARIABLE_LABELS
Then to estimate NewMeasure:
from frds import Professor
measures = [
NewMeasure(),
]
config = dict(
wrds_username="your_wrds_username",
wrds_password="you_wrds_password",
result_dir="path/to/where/you/want/to/store/the/result/",
data_dir="path/to/where/you/want/to/store/the/data/",
)
if __name__ == "__main__":
with Professor(config=config) as prof:
prof.calculate(measures)
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
File details
Details for the file frds-0.4.1.tar.gz.
File metadata
- Download URL: frds-0.4.1.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8dd267df8008fe32d6a372efeb4907f99a8228c6de4a988371ea6cab262e2b
|
|
| MD5 |
a2a004f9c7ca7b0ffa0b6371122d35ea
|
|
| BLAKE2b-256 |
73402ae60a38be66f00904d97069e8603a443f3737fd943c70ebf902ed181734
|