I think what we really need is getting all corporate action data given an ex_date rather than process date. So far to achieve this goal I need to fetch excessive amount of data and filter on ex_date. Which is slow and invonvenient. Can we simply allow users to filter by ex_date similar to Polygon does?
@PatL Good point. I’ll pass a request to the Product Team to add an addition filter for ex_date.
You can however rather simply filter for ex_date locally, I wouldn’t worry too much about ‘excessive’ amounts of data. The Corporate Actions endpoint returns data quite quite fast. Below is some python code using the alpaca-py SDK to filter by ex_date locally. This gets all corporate actions that have an ex_date of 2025-08-28 or 2025-08-29.
import pandas as pd
from alpaca.data.historical.corporate_actions import CorporateActionsClient
from alpaca.data.requests import CorporateActionsRequest
# instantiate a CorporateActionsClient
client = CorporateActionsClient(ALPACA_API_KEY, ALPACA_API_SECRET_KEY)
# fetch corporate actions
corp_actions = (client.get_corporate_actions(
CorporateActionsRequest(
#symbols=['AAPL', 'IBM'] omit for all symbols,
types=['cash_dividend', 'stock_dividend'],
start='2025-08-28',
end='2025-09-01')
))
# convert corporate actions dict into a dataframe
corp_actions_df = corp_actions.df
# convert ex_date from string to datetime
corp_actions_df.ex_date = pd.to_datetime(corp_actions_df.ex_date)
# set the list of ex_dates to search for
search_ex_dates = pd.to_datetime(['2025-08-28','2025-08-29'])
# query for corp actions in the list of ex_dates
corp_actions_in_ex_dates = corp_actions_df.query('ex_date in @search_ex_dates')
Note that the API end dates look at the process_date which can be several days (or more) after the ex_date so ensure you set the end accordingly. Also, a limitation of the alpaca-py SDK is it only returns 1000 corporate actions and doesn’t page. If you expect more than 1000, you will need to implement your own paging.