How to extract and display Dividends Calendar and Dividends historical data using Python.

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.

Dividends Calendar.



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.


Python code to extract todays' Dividends:



# 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)


Todays' Dividends output:


Dividends today output.


Python code to get Dividends for a certain date:



dividends = fc.get_dividends_by_date(datetime(2022, 9, 16, 0, 0))
print(dividends)

Dividends for a certain date output:


Dividends by date output.


Python code to get Dividends historical for a certain stock:



div_hist = fc.get_div_hist_per_stock('MSFT')
print(div_hist)

Dividends historical for a certain stock output:


Dividends historical by stock output.



Python code to get Dividends historical for a certain ETF:



div_hist = fc.get_div_hist_per_etf('QQQM')
print(div_hist)

Dividends historical for a certain ETF output:


Dividends historical by etf output.





See also related topics: