Download Open Source Asset Pricing (OpenAP) Data Directly

Convenient download functions enabling access Open Source Asset Pricing (OpenAP) data. This package enables users to download predictor portfolio returns (over 200 cross-sectional predictors with multiple portfolio construction methods) and firm characteristics (over 200 characteristics replicated from the academic asset pricing literature). Center for Research in Security Prices (CRSP)-based variables such as Price, Size, and Short-term Reversal can be downloaded with a Wharton Research Data Services (WRDS, < https://wrds-www.wharton.upenn.edu/>) subscription. For a full list of what is available, see < https://www.openassetpricing.com/>. Data are read from the OpenAP Hugging Face dataset < https://huggingface.co/datasets/OpenSourceAP/CrossSection>, which holds data releases from 2020 onward.


OpenSourceAP.DownloadR

OpenSourceAP_DownloadR is an R package that allows you to download data from Open Source Asset Pricing.

Installation

install.packages("OpenSourceAP.DownloadR")
# or
devtools::install_github("tomz23/OpenSourceAP.DownloadR")

Data are read from the OpenAP Hugging Face dataset, where each data release is a branch. No account or token is needed.

Usage

Import package and open an instance to the data

library(OpenSourceAP.DownloadR)

openap <- OpenAP$new()

# a specific release (2020_05 through 2026_10; 2026_10 is the default)
openap_2024 <- OpenAP$new("2024_10")

Older releases differ in what they contain. For example, daily portfolios start with 2021_04, SignalDoc.csv with 2022_03, and the 2020 releases have their own portfolio files (portbase, allportretdec, ...) and unsigned signals only. list_port() shows what a release has.

List available portfolios (various implementations)

openap$list_port()

Signal documentation

openap$dl_signal_doc()

Download portfolio returns

# download all original paper portfolios
openap$dl_port('op')

# download all decile-value-weighted portfolios
openap$dl_port('deciles_vw')

# Download portfolios for specific signals
openap$dl_port('op', 'AssetGrowth')

Download firm characteristics

Only the requested columns are downloaded.

openap$dl_signal(c("BM", "Mom12m"))

# signed so that high values predict high returns
openap$dl_signal(c("BM", "Mom12m"), signed = TRUE)

To download all signals, or the CRSP signals Price, Size and STreversal, you need a WRDS account.

openap$dl_all_signals()

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("OpenSourceAP.DownloadR")

0.2.0 by Tom Zimmermann, 9 days ago


Browse source code at https://github.com/cran/OpenSourceAP.DownloadR


Authors: Tom Zimmermann [aut, cre] (ORCID: , Justus Boeker [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports httr, curl, jsonlite, nanoparquet, dplyr, R6, DBI, RPostgres, getPass

Suggests knitr, rmarkdown, testthat


See at CRAN