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

**URL:** <https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030>\
**Category:** Package Announcements\
**Tags:** package, announcement, finance\
**Created:** [March 15, 2020, 11:55pm UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030 "2020-03-15T23:55:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 15, 2020, 11:55pm UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030/1 "2020-03-15T23:55:58Z")

</div>

Happy to announce a small package I put together since I’m stuck at home – [FamaFrenchData.jl](https://github.com/tbeason/FamaFrenchData.jl). It provides easy direct access to the [Ken French Data Library](https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html), 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

```julia
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.

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [March 18, 2020, 3:34am UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030/2 "2020-03-18T03:34:47Z")

</div>

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

> [@Querying WRDS Data using Julia](https://discourse.julialang.org/t/querying-wrds-data-using-julia/31835):
>
> I have written a short tutorial about querying WRDS data using Julia. A user only needs to input her username and password to work with WRDS remotely in Julia. Basically, I translated the existing tutorial about querying WRDS data using R to Julia. [https://wrds-www.wharton.upenn.edu/pages/support/programming-wrds/programming-r/querying-wrds-data-r/](https://wrds-www.wharton.upenn.edu/pages/support/programming-wrds/programming-r/querying-wrds-data-r/) WRDS is the standard data source used by many finance and accounting departments. If you have a wrds account, please go ahead and try my tutorial. …

Below is a snippet of the codes:

```julia
#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

```

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 18, 2020, 4:15am UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030/3 "2020-03-18T04:15:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [March 27, 2020, 1:16am UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030/4 "2020-03-27T01:16:11Z")

</div>

I just came across: [EconDatasets.jl](http://juliafinmetrix.github.io/EconDatasets.jl/) which claims to all have FF, but doesn’t seem to be updated…

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 27, 2020, 2:24am UTC](https://discourse.julialang.org/t/ann-famafrenchdata-jl-easy-access-to-fama-french-data/36030/5 "2020-03-27T02:24:54Z")

</div>

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 🙂
