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 is an R package that allows you to download data from Open Source Asset Pricing.
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.
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.
openap$list_port()
openap$dl_signal_doc()
# 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')
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()