Code Monkey home page Code Monkey logo

financeroutines.jl's Introduction

FinanceRoutines

Documentation Build Status
CI Testing

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

Installation

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")

Examples

Import data from WRDS

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)

Import the Fama-French three factors

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)

Estimate treasury bond returns

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)

To Do

  • olsgmm from cochrane GMM code
  • rolling regressions

Othere references to work with financial data

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.