Python Financial Events: Find Stocks Announcing Earnings or Dividends (EOD API) | Part 8 ๐Ÿ“…

Matt Macarty ยท Beginner ยทโšก Algorithms & Data Structures ยท4y ago

About this lesson

@MattMacarty ## ๐Ÿ Python Financial Events: Find Stocks Announcing Earnings or Dividends (EOD API) | Part 8 Welcome to Part 8 of the **Python Stock Analysis Course**! This video goes beyond simple price data and dives into fetching crucial **corporate event data** from the **EOD Historical Data API**. You will learn how to write functions to identify companies that are about to announce **Earnings** or have an upcoming **Dividend Ex-Date**. A key focus of this video is learning how to **filter global API results** down to a specific exchange (e.g., U.S. markets) using simple Python string manipulation. ### ๐ŸŽฏ Key Learning Outcomes: 1. **Earnings Calendar:** Write a function to fetch the list of all companies globally reporting **Earnings** this week. 2. **Global Data Filtering:** Implement logic to filter the global list of earnings announcements down to only **U.S.-listed stocks** (by checking for the exchange suffix on the symbol/code). 3. **Dividend Data:** Learn how to use the API's **`get_bulk_markets`** endpoint to specifically request a list of all stocks on a given exchange (e.g., US) that have a **Dividend Ex-Date** on a specified day. 4. **Data Structure Review:** Understand the key data points returned for dividends, such as the rate, currency, and payout frequency. ### โฑ๏ธ Video Chapters (Jump Ahead!): 0:00 - Introduction (Focus on Events: Earnings & Dividends) 0:46 - **Function 1: Getting Companies Reporting Earnings This Week** 1:01 - Downloading Global Earnings Data with the API Client 1:28 - **Filtering Global Results to U.S. Stocks Only** (Checking for `.US` suffix) 2:33 - Testing the Earnings Function and Reviewing the Count 3:24 - **Function 2: Getting Dividends for a Specific Ex-Date** 3:50 - Using the **`get_bulk_markets`** Endpoint for Events 4:38 - Testing the Dividend Function and Reviewing the Data 5:23 - Preview of Part 9: Building a simple **Stock Screener** ### ๐Ÿ”— Course Series & Resources: * **Part 7 (Performance Grid):** [http

Full Transcript

this is going to be part 8 in my series on using python for stock analysis and in this video we're going to start taking a deeper look at the end of the historical data api so beyond getting prices there we're going to sort of get events so the api is pretty comprehensive and i'm not going to be able to get through all of it but i'm going to show you a couple examples of things that you might want to do and then the documentation is really good so if you go out to their website and start reading through it you'll probably find what you're looking for in terms of data sets right so we're going to be looking at getting earnings and this is going to be for companies reporting this week and then we're going to get dividends for a specific x date okay so we'll go ahead and try to get the company's reporting earnings this week and so i'm going to start with my api client all right i'm going to pass in my api key you're going to need to replace this with your api key and then i'm just going to go ahead and download all the data and i'm going to store it in a data frame okay so this particular function does not require any parameters be passed in all right so we've downloaded all the companies reporting this week okay so this data frame has a few columns in there i just want the symbols so i'll make a list to store that in all right and then we're just going to start looping through and what you get when you make this call is you get all the companies around the world that are reporting this week if you want just a specific exchange like the u.s well you're going to have to filter out the data all right and there are a few ways to do that i'm just going to loop over each row in this data frame okay then we're just going to test to see if the symbol at this row ends with us okay and stock symbols on end of day historical data are referred to as codes and all of the codes end with the exchange that they come from all right so if we want just the u.s we're going to test it like that okay and then once we found a relevant code we're going to append it to our list all right and i i don't want the the the exchange data appended so i'll just leave that off okay that's pretty much all there is to it once we're done with that we can print off how many companies are reporting today actually this week all right and then yeah we'll return those symbols so then you can maybe do some other analysis there okay let's try that out okay so there's a list of all the tickers and oops i forgot to make that an f string oops wrong language there we go all right one more time okay so 121 in that list and then yeah you could do some kind of analysis there if you wanted to all right so let's take a look at how to get dividends from a specific x date all right and i'm just going to start with uh today all right and you know this function is going to start pretty much the same way we're going to need to make a client with the api key and then we're just going to go out and call a function okay so once we have that we're just going to again save this into a data frame all right and the function we're going to use here is called get bulk markets all right so there's a few things you can get from this function and you can get the closing price for an entire market if you want all right i'm going to use it to get the dividends all right and i'll leave it up to you to kind of research what else you can get with this endpoint all right so we're going to need to pass in our exchange all right and let me uh let me break this up onto another line okay and then this is where you pass in what you're looking for all right so it's dividends all right and then yeah it's it's just that hard and then once we do that we're going to return the data frame okay so let's try that one see who is uh have an x date of today as of this video anyway see if we get lucky all right so i'm going to print that one off i think everything else i said as a default right the us and then today all right let's try it out see if i did that error free all right and so uh there they are and there's actually quite a few all right with an x date of uh today and uh the nice thing you get from this data frame let me spread it out a little bit is uh obviously the rate all right and then yeah since it's the u.s market i guess it's going to be u.s dollars all right but then it tells you how often uh they pay it right so this one's quarterly right twice a year and then this must be a special dividend all right so that's gonna do it for uh part eight and part nine i'm gonna kind of wrap up section one and we're gonna see how to start building a simple screener so hope to see you there

Original Description

@MattMacarty ## ๐Ÿ Python Financial Events: Find Stocks Announcing Earnings or Dividends (EOD API) | Part 8 Welcome to Part 8 of the **Python Stock Analysis Course**! This video goes beyond simple price data and dives into fetching crucial **corporate event data** from the **EOD Historical Data API**. You will learn how to write functions to identify companies that are about to announce **Earnings** or have an upcoming **Dividend Ex-Date**. A key focus of this video is learning how to **filter global API results** down to a specific exchange (e.g., U.S. markets) using simple Python string manipulation. ### ๐ŸŽฏ Key Learning Outcomes: 1. **Earnings Calendar:** Write a function to fetch the list of all companies globally reporting **Earnings** this week. 2. **Global Data Filtering:** Implement logic to filter the global list of earnings announcements down to only **U.S.-listed stocks** (by checking for the exchange suffix on the symbol/code). 3. **Dividend Data:** Learn how to use the API's **`get_bulk_markets`** endpoint to specifically request a list of all stocks on a given exchange (e.g., US) that have a **Dividend Ex-Date** on a specified day. 4. **Data Structure Review:** Understand the key data points returned for dividends, such as the rate, currency, and payout frequency. ### โฑ๏ธ Video Chapters (Jump Ahead!): 0:00 - Introduction (Focus on Events: Earnings & Dividends) 0:46 - **Function 1: Getting Companies Reporting Earnings This Week** 1:01 - Downloading Global Earnings Data with the API Client 1:28 - **Filtering Global Results to U.S. Stocks Only** (Checking for `.US` suffix) 2:33 - Testing the Earnings Function and Reviewing the Count 3:24 - **Function 2: Getting Dividends for a Specific Ex-Date** 3:50 - Using the **`get_bulk_markets`** Endpoint for Events 4:38 - Testing the Dividend Function and Reviewing the Data 5:23 - Preview of Part 9: Building a simple **Stock Screener** ### ๐Ÿ”— Course Series & Resources: * **Part 7 (Performance Grid):** [http
Watch on YouTube โ†— (saves to browser)
Sign in to unlock AI tutor explanation ยท โšก30

Related Reads

๐Ÿ“ฐ
Day 29/100 Koko Eating Bananas (Binary Search)
Learn to implement binary search to solve the Koko Eating Bananas problem and improve your algorithmic skills
Medium ยท Programming
๐Ÿ“ฐ
O(N) Manacher's Algorithm with Mirror Boundary Optimization
Learn to optimize palindrome detection using Manacher's Algorithm with mirror boundary optimization, reducing time complexity to O(N)
Dev.to ยท Dipaditya Das
๐Ÿ“ฐ
Building a Power Grid Inside Minecraft with BFS Algorithms
Learn to build a power grid inside Minecraft using BFS algorithms and understand its relevance to cloud services
Dev.to ยท Carlos Cortez ๐Ÿ‡ต๐Ÿ‡ช [AWS Hero]
๐Ÿ“ฐ
The Run-Length Encoding Trick: How Simple Strings Get Compressed
Learn how Run-Length Encoding (RLE) compresses simple strings, a fundamental technique in programming and data compression, and apply it to optimize storage and transmission of data
Medium ยท Programming

Chapters (9)

Introduction (Focus on Events: Earnings & Dividends)
0:46 **Function 1: Getting Companies Reporting Earnings This Week**
1:01 Downloading Global Earnings Data with the API Client
1:28 **Filtering Global Results to U.S. Stocks Only** (Checking for `.US` suffix)
2:33 Testing the Earnings Function and Reviewing the Count
3:24 **Function 2: Getting Dividends for a Specific Ex-Date**
3:50 Using the **`get_bulk_markets`** Endpoint for Events
4:38 Testing the Dividend Function and Reviewing the Data
5:23 Preview of Part 9: Building a simple **Stock Screener**
Up next
Stump Grinder Carbide Wheel Grinds Hardwood To Chips
Innoforge Studio
Watch โ†’