EOD Historical Data
Upcoming Dividends
Introduction
The Upcoming Dividends dataset, provided by EODHD, offers daily alerts for US Equities that will have a dividend event within the upcoming 7 days. The data starts in January 2015 and is delivered on a daily frequency.
Compared to US Equity Security Master as a benchmark, the Upcoming Dividends dataset has a 98.56% coverage of all dividend events, while having a 99.71% precision on the exact dividend dates of the covered ones and a 99.90% precision within +/- 3 days.
For more information about the Upcoming Dividends dataset, including CLI commands and pricing, see the dataset listing.
About the Provider
EOD Historical Data (EODHD) is a financial data provider based in France, and founded in April 2015. They focus on providing clean financial data, including stock prices, splits, dividends, fundamentals, macroeconomic indicators, technical indicators, and alternative data sources, through 24/7 API seamlessly. For more information about EODHD, visit https://eodhd.com/.
Example Applications
The Upcoming Dividends dataset allows traders to trade the price change due to dividends. Examples include the following strategies:
- Short the stocks on dividend report day to earn the dividend discount on pricing.
- Avoid volatility on securities with upcoming dividends
For more example algorithms, see Examples.
Universe Selection
To select a dynamic universe of US Equities based on the Upcoming Dividends dataset, call the add_universe
method with a EODHDUpcomingDividends
cast.
def initialize(self) -> None: self._universe = self.add_universe(EODHDUpcomingDividends, self.universe_selection_filter) def universe_selection_filter(self, dividends: List[EODHDUpcomingDividends]) -> List[Symbol]: return [d.symbol for d in dividends if d.dividend_date <= self.time + timedelta(1) and d.dividend > 0.05]
For more information about universe settings, see Settings.
Requesting Data
To add Upcoming Dividends data to your algorithm, call the add_data
method.
class UpcomingDividendsDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2019, 1, 1) self.set_end_date(2020, 6, 1) self.set_cash(100000) self._symbol = self.add_equity("AAPL", Resolution.DAILY).symbol self.dataset_symbol = self.add_data(EODHDUpcomingDividends, "dividends").symbol
Accessing Data
To get the current Upcoming Dividends data, call the get(EODHDUpcomingDividends)
method from the current Slice
and index the result with the security Symbol
. Slice
objects deliver unique events to your algorithm as they happen, but the Slice
may not contain data for your security at every time step. To avoid issues, check if the Slice
contains the data you want before you index it.
def on_data(self, slice: Slice) -> None: upcomings_dividends = slice.get(EODHDUpcomingDividends) if upcomings_dividends and self._symbol in upcomings_dividends: upcomings_dividends_data_point = upcomings_dividends[self._symbol] self.log(f"{self._symbol} will pay dividend at {upcomings_dividends_data_point.dividend_date} with dividend per share of ${upcomings_dividends_data_point.dividend}")
You can also iterate through all of the dataset objects in the current Slice
def on_data(self, slice: Slice) -> None: for equity_symbol, upcomings_dividends_data_point in slice.get(EODHDUpcomingDividends).items(): self.log(f"{equity_symbol} will pay dividend at {upcomings_dividends_data_point.dividend_date} with dividend per share of ${upcomings_dividends_data_point.dividend}")
Historical Data
To get historical Upcoming Dividends data, call the history
method with the type EODHDUpcomingDividends
cast and the period of request. If there is no data in the period you request, the history result is empty.
history = self.history[EODHDUpcomingDividends](timedelta(100), Resolution.DAILY)
For more information about historical data, see History Requests.
Example Applications
The Upcoming Dividends dataset allows traders to trade the price change due to dividends. Examples include the following strategies:
- Short the stocks on dividend report day to earn the dividend discount on pricing.
- Avoid volatility on securities with upcoming dividends
For more example algorithms, see Examples.