Download and Process Open Source Asset Pricing Data
Source:R/download_data_osap.R
download_data_osap.RdDownloads the data from Open Source Asset Pricing from Google Sheets using a specified sheet ID, processes the data by converting column names to snake_case, aligning the date to the beginning of the month, scaling the percentage long-short returns to numeric values, and optionally filters the data based on a provided date range.
Usage
download_data_osap(
start_date = NULL,
end_date = NULL,
sheet_id = "1JyhcF5PRKHcputlioxlu5j5GyLo4JYyY"
)Arguments
- start_date
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the data. If not provided, the full dataset is returned.
- end_date
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the data. If not provided, the full dataset is returned.
- sheet_id
A character string representing the Google Sheet ID from which to download the data. Default is
"1JyhcF5PRKHcputlioxlu5j5GyLo4JYyY".
Value
A tibble containing the processed data. The column names
are converted to snake_case, the date column is aligned to the
beginning of the month, all predictor columns (long-short returns
in percent) are divided by 100 to obtain plain numeric (decimal)
returns, and the data is filtered by the specified date range if
start_date and end_date are provided.
Details
The dataset contains monthly long-short returns of the predictor
portfolios. Every column other than date is a return expressed in
percent, so all of them are divided by 100 to convert them into plain
numeric (decimal) returns.
See also
Other download functions:
download_data(),
download_data_constituents(),
download_data_factors_ff(),
download_data_factors_q(),
download_data_fred(),
download_data_fred_md(),
download_data_huggingface(),
download_data_jkp(),
download_data_macro_predictors(),
download_data_pastor_stambaugh(),
download_data_risk_free(),
download_data_stambaugh_yuan(),
download_data_stock_prices(),
download_factor_library_grid(),
download_factor_library_ids()