Download split and dividend data
In the previous exercise, you used adjustOHLC()
to adjust raw historical OHLC prices for splits and dividends, but it only works for OHLC data. It will not work if you only have close prices, and it does not return any of the split or dividend data it uses.
You need the dates and values for each split and dividend to adjust a non-OHLC price series, or if you simply want to analyze the raw split and dividend data.
You can download the split and dividend data from Yahoo Finance using the quantmod functions getSplits()
and getDividends()
, respectively. The historical dividend data from Yahoo Finance is adjusted for splits. If you want to download unadjusted dividend data, you need to set split.adjust = FALSE
in your call to getDividends()
.
Este exercício faz parte do curso
Importing and Managing Financial Data in R
Instruções do exercício
- Use
getSplits()
to import AAPL split data intosplits
. - Use
getDividends()
to import split-adjusted AAPL dividend data intodividends
. - Look at the first few rows of
dividends
. The values are small and in fractional cents because they have been split-adjusted. - Use
getDividends()
to import unadjusted AAPL dividend data intoraw_dividends
. - Look at the first few rows of
raw_dividends
. Note they differ from the values individends
.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Download AAPL split data
# Download AAPL dividend data
# Look at the first few rows of dividends
# Download AAPL dividend data that is not split-adjusted
# Look at the first few rows of raw_dividends