EOD Historical Data

Upcoming Earnings

Introduction

The Upcoming Earnings dataset, provided by EOD Historical Data (EODHD), is a daily universe of US Equities with an earnings report publication in the upcoming 7 days. The data starts in January 1998 and is delivered on a daily frequency.

For more information about the Upcoming Earnings 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/.

Getting Started

The following snippet demonstrates how to request data from the Upcoming Earnings dataset:

self.add_universe(EODHDUpcomingEarnings, self.selection_function)
AddUniverse<EODHDUpcomingEarnings>(SelectionFunction);

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 1998
Data DensitySparse
ResolutionDaily
TimezoneNew York

Example Applications

The Upcoming Earnings dataset provides timely notifications about earnings announcements, allowing traders to make capitalize on potential price movements and manage risks effectively. Examples include the following strategies:

  • Short Straddle to trade on heightened volatility during earnings report.
  • Filter universe for the stocks with or without upcoming earnings report to trade or avoid volatility.
  • Hold the stocks with upcoming earnings estimated to be positive.

Data Point Attributes

The EODHD Upcoming Earnings dataset provides EODHDUpcomingEarnings objects, which have the following attributes:

Universe Selection

To select a dynamic universe of US Equities based on the Upcoming Earnings dataset, call the AddUniverseadd_universe method with a EODHDUpcomingEarnings cast.

def initialize(self) -> None:
    self._universe = self.add_universe(EODHDUpcomingEarnings, self.universe_selection_filter)

def universe_selection_filter(self, earnings: List[EODHDUpcomingEarnings]) -> List[Symbol]:
    return [d.symbol for d in earnings if d.report_date <= self.time + timedelta(3) and d.estimate > 0]
public override void Initialize()
{
    _universe = AddUniverse<EODHDUpcomingEarnings>(UniverseSelectionFilter);
}

private IEnumerable<Symol> UniverseSelectionFilter(IEnumerable<EODHDUpcomingEarnings> earnings)
{
    return from d in earnings
           where d.ReportDate <= Time.AddDays(3) && d.Estimate > 0m
           select d.Symbol;
}

For more information about universe settings, see Settings.

Requesting Data

This dataset is designed for universe selection. However, you can add Upcoming Earnings data to your algorithm using the AddData<EODHDUpcomingEarnings>add_data method.

class UpcomingEarningsDataAlgorithm(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(EODHDUpcomingEarnings, "earnings").symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class UpcomingEarningsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<EODHDUpcomingEarnings>("earnings").Symbol;
        }
    }
}

Accessing Data

To get the current Upcoming Earnings data, call the Get<EODHDUpcomingEarnings>get(EODHDUpcomingEarnings) 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_earnings_for_symbol = slice.get(EODHDUpcomingEarnings).get(self._symbol)
        if upcomings_earnings_for_symbol:
            self.log(f"{self._symbol} will report earnings at {upcomings_earnings_for_symbol.report_date} {upcomings_earnings_for_symbol.report_time} with estimated EPS {upcomings_earnings_for_symbol.estimate}")
public override void OnData(Slice slice)
{
    var upcomingEarnings = slice.Get<EODHDUpcomingEarnings>();
    if (upcomingEarnings.TryGetValue(_symbol, out var upcomingEarningsDataPoint))
    {
        Log($"{_symbol} will report earnings at {upcomingEarningsDataPoint.ReportDate} {upcomingEarningsDataPoint.ReportTime} with estimated EPS {upcomingEarningsDataPoint.Estimate}");
    }
}

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_earnings_data_point in slice.get(EODHDUpcomingEarnings).items():
        self.log(f"{equity_symbol} will report earnings at {upcomings_earnings_data_point.report_date} {upcomings_earnings_data_point.report_time} with estimated EPS {upcomings_earnings_data_point.estimate}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<EODHDUpcomingEarnings>())
    {
        var equitySymbol = kvp.Key;
        var upcomingEarningsDataPoint = kvp.Value;
        Log($"{equitySymbol} will report earnings at {upcomingEarningsDataPoint.ReportDate} {upcomingEarningsDataPoint.ReportTime} with estimated EPS {upcomingEarningsDataPoint.Estimate}");
    }
}

Historical Data

To get historical Upcoming Earnings for the universe, call the Historyhistory method with the type EODHDUpcomingEarning.

history = self.history(EODHDUpcomingEarnings, timedelta(100), Resolution.DAILY)
var history = History<EODHDUpcomingEarnings>(TimeSpan.FromDays(100), Resolution.Daily);

To get historical Upcoming Earnings data for a known security, call the Historyhistory method with the type EODHDUpcomingEarning cast and the security Symbol.

history = self.history[EODHDUpcomingEarnings](timedelta(100), Resolution.DAILY).loc[self._symbol]
var history = History<EODHDUpcomingEarnings>(TimeSpan.FromDays(100), Resolution.Daily)
    .Select(x => x[_symbol])
    .ToList();

If there is no data in the period you request, the history result is empty. For more information about historical data, see History Requests.

Remove Subscriptions

To remove a subscription, call the RemoveSecurityremove_security method.

self.remove_security(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The Upcoming Earnings dataset provides timely notifications about earnings announcements, allowing traders to make capitalize on potential price movements and manage risks effectively. Examples include the following strategies:

  • Short Straddle to trade on heightened volatility during earnings report.
  • Filter universe for the stocks with or without upcoming earnings report to trade or avoid volatility.
  • Hold the stocks with upcoming earnings estimated to be positive.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: