Documentation | Build Status |
---|---|
FinanceRoutines.jl
is a package that contains useful functions to download and process academic financial data.
So far the package provides function to import:
- CRSP and Compustat from the WRDS Postgres server
- Fama-French three factors series from Ken French's website
- GSW Yield curves from the NY Fed
FinanceRoutines.jl
is a not yet a registered package.
You can install it from github via
import Pkg
Pkg.add(url="https://github.com/eloualiche/FinanceRoutines.jl")
First import the monthly stock file and the compustat funda file
using FinanceRoutines
using DataFrames
# Set up a wrds connection
wrds_conn = FinanceRoutines.open_wrds_pg()
# CRSP
df_msf = import_MSF(wrds_conn); # Import the monthly stock file
build_MSF!(df_msf); # Run common processing
# Compustat
df_funda = import_Funda(wrds_conn);
build_Funda!(df_funda)
# Merge both files
df_linktable = FinanceRoutines.import_ccm_link(wrds_conn)
df_msf = link_MSF(df_linktable, df_msf) # merge gvkey on monthly stock file
df_msf = innerjoin(df_msf, df_funda, on = [:gvkey, :datey], matchmissing=:notequal)
This downloads directly data from Ken French's website and formats the data
df_FF3 = import_FF3()
# there is an option to download the daily factors
df_FF3_daily = import_FF3(:daily)
The function downloads yield curves from the NY Fed GSW and estimate returns based on the curves
df_GSW = import_GSW();
estimate_yield_GSW!(df_GSW; maturity=1); # maturity is in years
select(df_GSW, :date, :yield_1y)
olsgmm
from cochrane GMM code- rolling regressions
The package the closest to this one is
- WrdsMerger.jl; WrdsMerger is probably in a more stable state than this package.
Other packages or sources of code I have used to process the WRDS data
- WRDS demo on momentum (python)
- Tidy Finance (R) Book and repo
- French data R package
- Ian Gow Quarto Book (R)
- Replication Open Source AP (stata)