From 2fcd521e997fd755fe921e1fbf1df2448135ffbc Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Sat, 29 Jun 2024 17:37:33 +0000 Subject: [PATCH] build based on 7a10844 --- dev/demo/beta/index.html | 2 +- dev/index.html | 2 +- dev/lib/internals/index.html | 2 +- dev/lib/public/index.html | 10 +++++----- dev/man/wrds_guide/index.html | 2 +- dev/search/index.html | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev/demo/beta/index.html b/dev/demo/beta/index.html index 08c76ad..cbbfe09 100644 --- a/dev/demo/beta/index.html +++ b/dev/demo/beta/index.html @@ -39,4 +39,4 @@ end end unique(df_msf, r"β") -select(unique(df_msf, r"β"), :permno, :β_MKT, :β_SMB, :β_HML)

Rolling betas

...

+select(unique(df_msf, r"β"), :permno, :β_MKT, :β_SMB, :β_HML)

Rolling betas

...

diff --git a/dev/index.html b/dev/index.html index 7981e37..092db7f 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,3 +1,3 @@ Home · FinanceRoutines.jl

FinanceRoutines.jl

Some useful tools to work with academic financial data in Julia

Introduction

This package provides a collection of routines for academic finance work. This is useful to get started with a clean copy of asset prices from CRSP and a ad-hoc merge with the accounting data from the Compustat Funda file.

I have also added utilities to download treasury yield curves (GSW) and Fama-French research factors.

This is still very much work in progress: file issues for comments.

Installation

FinanceRoutines.jl is a not yet a registered package. You can install it from github via

import Pkg
-Pkg.add("https://github.com/eloualiche/FinanceRoutines.jl")

Usage

  • Using WRDS (CRSP, Compustat, etc)

    • See the WRDS User Guide for an introduction to using the package to download data from WRDS
  • Demos to how this integrates into standard estimations

Other Resources

There are multiple online resources on using the WRDS Postgres database and build the standard finance and accounting datasets:

  • Ian D. Gow and Tony Ding: "Empirical Research in Accounting: Tools and Methods"; available here
  • Chen, Andrew Y. and Tom Zimmermann: "Open Source Cross-Sectional Asset Pricing"; 2022, 27:2; available here
  • Christoph Scheuch, Stefan Voigt, Patrick Weiss: "Tidy Finance with R"; 2023; Chapman & Hall; available here

Index

+Pkg.add("https://github.com/eloualiche/FinanceRoutines.jl")

Usage

Other Resources

There are multiple online resources on using the WRDS Postgres database and build the standard finance and accounting datasets:

Index

diff --git a/dev/lib/internals/index.html b/dev/lib/internals/index.html index 126d057..ec6b556 100644 --- a/dev/lib/internals/index.html +++ b/dev/lib/internals/index.html @@ -1,2 +1,2 @@ -Package Internals · FinanceRoutines.jl
+Package Internals · FinanceRoutines.jl
diff --git a/dev/lib/public/index.html b/dev/lib/public/index.html index 0c9496d..490758d 100644 --- a/dev/lib/public/index.html +++ b/dev/lib/public/index.html @@ -1,12 +1,12 @@ -Public Interface · FinanceRoutines.jl

Public Interface

FinanceRoutines Module

FinanceRoutines.build_Funda!Method
build_Funda!(df_funda::DataFrame; save)

Clean up the compustat funda file download from crsp (see import_Funda)

Arguments

  • df_funda::DataFrame: A standard dataframe with compustat data (minimum variables are in import_Funda)

Keywords

  • save::String: Save a gzip version of the data on path $save/funda.csv.gz; Default does not save the data.

Returns

  • df_funda::DataFrame: DataFrame with compustat funda file "cleaned"
source
FinanceRoutines.build_MSF!Method
build_MSF!(df_msf::DataFrame; save)

Clean up the CRSP Monthly Stock File (see import_MSF)

Arguments

  • df::DataFrame: A standard dataframe with compustat data (minimum variables are in import_Funda)

Keywords

  • save::String: Save a gzip version of the data on path $save/funda.csv.gz; Default does not save the data.
  • trim_col::Bool: Only keep a subset of relevant columns in the final dataset
source
FinanceRoutines.estimate_return_GSW!Method
estimate_return_GSW!

arguments

- `maturity::Real`: in years
+Public Interface · FinanceRoutines.jl

Public Interface

FinanceRoutines Module

FinanceRoutines.build_Funda!Method
build_Funda!(df_funda::DataFrame; save)

Clean up the compustat funda file download from crsp (see import_Funda)

Arguments

  • df_funda::DataFrame: A standard dataframe with compustat data (minimum variables are in import_Funda)

Keywords

  • save::String: Save a gzip version of the data on path $save/funda.csv.gz; Default does not save the data.

Returns

  • df_funda::DataFrame: DataFrame with compustat funda file "cleaned"
source
FinanceRoutines.build_MSF!Method
build_MSF!(df_msf::DataFrame; save)

Clean up the CRSP Monthly Stock File (see import_MSF)

Arguments

  • df::DataFrame: A standard dataframe with compustat data (minimum variables are in import_Funda)

Keywords

  • save::String: Save a gzip version of the data on path $save/funda.csv.gz; Default does not save the data.
  • trim_col::Bool: Only keep a subset of relevant columns in the final dataset
source
FinanceRoutines.estimate_return_GSW!Method
estimate_return_GSW!

arguments

- `maturity::Real`: in years
 - `frequency::Symbol`: :daily, :monthly, :annual type 
-- `type::Symbol`: :log or standard one-period arithmetic return
source
FinanceRoutines.import_FF3Method
import_FF3(frequency::Symbol)

Download and import the Fama-French 3 Factors from Ken French website.

If frequency is unspecified, import the monthly research returns. If frequency is :daily, import the daily research returns.

source
FinanceRoutines.import_FF3Method
import_FF3(frequency::Symbol)

Download and import the Fama-French 3 Factors from Ken French website.

If frequency is unspecified, import the monthly research returns. If frequency is :daily, import the daily research returns.

source
FinanceRoutines.import_FundaMethod
import_Funda(wrds_conn; date_range, variables)
 import_Funda(; 
     date_range::Tuple{Date, Date} = (Date("1900-01-01"), Dates.today()),
-    variables::String = "", user="", password="")

Import the funda file from CapitalIQ Compustat on WRDS Postgres server

Arguments

  • wrds_conn::Connection: An existing Postgres connection to WRDS; creates one if empty

Keywords

  • date_range::Tuple{Date, Date}: A tuple of dates to select data (limits the download size)
  • variables::Vector{String}: A vector of String of additional variable to include in the download
  • user::String: username to log into the WRDS cli; default to ask user for authentication
  • password::String: password to log into the WRDS cli

Returns

  • df_funda::DataFrame: DataFrame with compustat funda file
source
FinanceRoutines.import_GSWMethod
import_GSW(; date_range)
+    variables::String = "", user="", password="")

Import the funda file from CapitalIQ Compustat on WRDS Postgres server

Arguments

  • wrds_conn::Connection: An existing Postgres connection to WRDS; creates one if empty

Keywords

  • date_range::Tuple{Date, Date}: A tuple of dates to select data (limits the download size)
  • variables::Vector{String}: A vector of String of additional variable to include in the download
  • user::String: username to log into the WRDS cli; default to ask user for authentication
  • password::String: password to log into the WRDS cli

Returns

  • df_funda::DataFrame: DataFrame with compustat funda file
source
FinanceRoutines.import_MSFMethod
import_MSF(wrds_conn; date_range, variables)
+GSW Curves

arguments

- `date_range::Tuple{Date, Date}`: range for selection of data
source
FinanceRoutines.import_MSFMethod
import_MSF(wrds_conn; date_range, variables)
 import_MSF(; 
     date_range::Tuple{Date, Date} = (Date("1900-01-01"), Dates.today()),
-    variables::String = "", user="", password="")

Import the CRSP Monthly Stock File (MSF) from CRSP on WRDS PostGre server

Arguments

  • wrds_conn::Connection: An existing Postgres connection to WRDS; creates one if empty

Keywords

  • date_range::Tuple{Date, Date}: A tuple of dates to select data (limits the download size)
  • variables::Vector{String}: A vector of String of additional variable to include in the download
  • user::String: username to log into the WRDS cli; default to ask user for authentication
  • password::String: password to log into the WRDS cli

Returns

  • df_msf_final::DataFrame: DataFrame with msf crsp file
source
+ variables::String = "", user="", password="")

Import the CRSP Monthly Stock File (MSF) from CRSP on WRDS PostGre server

Arguments

  • wrds_conn::Connection: An existing Postgres connection to WRDS; creates one if empty

Keywords

  • date_range::Tuple{Date, Date}: A tuple of dates to select data (limits the download size)
  • variables::Vector{String}: A vector of String of additional variable to include in the download
  • user::String: username to log into the WRDS cli; default to ask user for authentication
  • password::String: password to log into the WRDS cli

Returns

  • df_msf_final::DataFrame: DataFrame with msf crsp file
source
diff --git a/dev/man/wrds_guide/index.html b/dev/man/wrds_guide/index.html index f8a0f1e..2e6a540 100644 --- a/dev/man/wrds_guide/index.html +++ b/dev/man/wrds_guide/index.html @@ -11,4 +11,4 @@ df_msf = link_MSF(df_linktable, df_msf) # merge gvkey on monthly stock file # merge for a crsp/compustat merged file -df_ccm = innerjoin(df_msf, df_funda, on = [:gvkey, :date_y], matchmissing=:notequal) +df_ccm = innerjoin(df_msf, df_funda, on = [:gvkey, :date_y], matchmissing=:notequal) diff --git a/dev/search/index.html b/dev/search/index.html index d476456..03c64ba 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · FinanceRoutines.jl

Loading search...

    +Search · FinanceRoutines.jl

    Loading search...