Earnings trends is analytical prediction of a company’s future earnings, and upcoming earnings are, essentially, dates of future earning reports of companies. Using those APIs from EODHD financial data written with Python expands your opportunity to analyze data for a more effective interaction with stocks.

Register & Get Data

Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. A more detailed information can be found on our Earnings Trends and Upcoming Earnings documentation web-page.

Accessing the EODHD API

To access the EODHD API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.

api = APIClient ("demo")

Please, note that you can also specify the API key in a configuration file or as an environment variable, as described in the library documentation here.

1. Use the “DEMO” API key to test our data from a limited set of the tickers without registering:
AAPL.US | TSLA.US VTI.US | AMZN.US | BTC-USD | EUR-USD
Real-Time Data and All of the APIs (except Bulk) are included without limitations on API calls.
2. Register to get your free API key (limited by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange
3. To unlock your API key we recommend to choose the subscription which covers your needs.

After we are done with the API client, we can start to request earnings trends and upcoming earnings data for some specific stock symbol, in particular for earnings trends.

earnings_trends = api.get_earning_trends_data (symbols = "AAPL.US, MS") # for Earnings Trends Data
upcoming_earnings = api. get_upcoming_earnings_data () # for Upcoming Earnings Data

The API response will be a single JSON structure.

By using Earnings Trends Data APIs, it is important to remember that, symbol is required.

Converting JSON Response to DataFrame

To convert JSON to DataFrame it is possible to use:

et = pd.DataFrame(earnings_trends) # for Earnings Trends Data
ue = pd.DataFrame(upcoming_earnings) # for Upcoming Earnings Data

All data in DataFrame will contain information such as: “type”, “description”, “symbols, “close”, for Earnings Trends and “type”, “description”, “from”, “to” for Upcoming Earnings. In case of Earnings Trends all information will be given for stock symbol, which was used when we called API.

print(et)
print(ue)

Extended functions of the Upcoming Earnings Data API

For a more accurate research, it is possible to use parameters that lays in Upcoming Earnings Data API. It is possible to use range of dates from and to, which will help to get information for certain dates. Also, you may use symbol to get upcoming earnings data for specific company.

up_earnings_extended = api.get_upcoming_earnings_data (from_date = "2020-12-10", to_date = "2021-04-10", symbols = "AAPL.US")

The API response is a JSON array containing data for all the requested tickers. You can convert the resulting JSON array to a DataFrame for further analysis:

ue_m = pd.DataFrame (up_earnings_extended)
print(ue_m)

Conclusion

Both of these EODHD financial data APIs allow for easier capitalizing on available opportunities. By using this APIs, it’s easy to keep in touch with future earnings of the companies you are interested or may become interested in.

Register & Get Data