[ANN] FamaFrenchData.jl - easy access to Fama-French data

Happy to announce a small package I put together since I’m stuck at home – FamaFrenchData.jl. It provides easy direct access to the Ken French Data Library, which is a popular data source for financial investments research. Ken French kindly makes a plethora of data available for download, but the files are non-standard CSV files and they come zipped. This package uses HTTP.jl, ZipFile.jl, and CSV.jl to source the file from the web, extract the contents, and read the tables into DataFrames.

It is still in early development, but the majority of the functionality is already in place. It can read from the web or from a local copy of the file. Getting the Fama-French 3 Factor model returns is as easy as

using FamaFrenchData, DataFrames

tables, tablenotes, filenotes = readFamaFrench("F-F_Research_Data_Factors")

FF3_monthly = tables[1]
FF3_annual = tables[2]

The package is in the process of being automatically merged to the general registry, so will be available via ]add FamaFrenchData in about 3 days time. PR’s welcome!

Thanks to those of you who helped answer some related questions I’ve posted recently.

8 Likes

Nice work. You can also retrieve fama french factor data via wrds following this thread:

Below is a snippet of the codes:

#Querying WRDS Data using Julia

#load required packages
################################################################
using LibPQ, Tables, DataFrames 
################################################################


#1. connect to wrds
wrds = LibPQ.Connection("""
                        host = wrds-pgdata.wharton.upenn.edu 
                        port = 9737
                        user='wrds account' 
                        password='wrds password'
                        sslmode = 'require' 
                        dbname = wrds
                        """)



#2. determine the datasets within the fama french (ff) library:
res = execute(wrds, "SELECT distinct table_name
                    FROM information_schema.columns
                    WHERE table_schema='ff'
                    ORDER BY table_name")

data = DataFrame(columntable(res))
res = 0
data


#3. Fama French 4 factors
res = execute(wrds, "SELECT * FROM ff.factors_daily
WHERE date BETWEEN '1991-01-01' AND '2018-12-31'")

data = DataFrame(columntable(res))
res = 0
data

Yea they have had the monthly and daily factors as well as the 2x3 and 5x5 size and book to market portfolios for a little bit now. But it is just those series and obviously requires a WRDS subscription.

I just came across: EconDatasets.jl which claims to all have FF, but doesn’t seem to be updated…

Yea that looks like a dead project. I had seen that before and thought that they only had the FF3 factors available, but you are right that it looks like maybe you could have gotten more than just that table.

Mine works :slight_smile: