Getting Dividends Calendars for trading.
To make efficient decisions for successful investments several market KPIs should be analyzed and Dividends which show a distribution of profits by a corporation to its shareholders is one of them.
The golden source of market information is NASDAQ - National Association of Securities Dealers Automated Quotation.
In our case we will use very handy Python package finance_calendars - a simple wrapper of NASDAQ public API for Financial Calendars.
Python Knowledge Base: Make coding great again.
- Updated:
2024-12-01 by Andrey BRATUS, Senior Data Analyst.
Python code to extract todays' Dividends:
Todays' Dividends output:
Python code to get Dividends for a certain date:
Dividends for a certain date output:
Python code to get Dividends historical for a certain stock:
Dividends historical for a certain stock output:
Python code to get Dividends historical for a certain ETF:
Dividends historical for a certain ETF output:
Now you will get all the information on Dividends including todays' data and historical information on any date or any stock and ETF. Output data is in Pandas dataframe format which can be easily converted to any suitable form for further visualisation and analysis.
# pip install finance-calendars
from finance_calendars import finance_calendars as fc
from datetime import datetime, date
import pandas as pd
dividends = fc.get_dividends_today()
print(dividends)
dividends = fc.get_dividends_by_date(datetime(2022, 9, 16, 0, 0))
print(dividends)
div_hist = fc.get_div_hist_per_stock('MSFT')
print(div_hist)
div_hist = fc.get_div_hist_per_etf('QQQM')
print(div_hist)