Dividend Yield
Calculate the dividend yield ratio, a valuation ratio that measures the amount of dividends distributed per share of stock relative to the stock’s price.
The dividend yield ratio is used by investors to assess the income potential of an investment in a company’s stock based on the dividends it pays out. A higher dividend yield can be attractive to income-seeking investors.
The formula is as follows:
\[\text{Dividend Yield} = \text{Dividends per Share} / \text{Share Price}\]The dividends per share are those paid over a year: the trailing four quarters with quarterly data, each year with annual data and, with show_daily, the 365 calendar days up to each day. The share price is the close at the end of the period (or day).
Also known as: annual dividend yield, income yield.
Dividend Yield in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_dividend_yield as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["KO", "PEP", "JNJ"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.ratios.get_dividend_yield()
Or, after setting up the Finance Toolkit MCP, ask:
What dividend yields did Coca-Cola, PepsiCo and Johnson & Johnson offer from 2021 to 2025?
Which returns:
| 2021 | 2022 | 2023 | 2024 | 2025 | |
|---|---|---|---|---|---|
| JNJ | 0.0245 | 0.0252 | 0.03 | 0.034 | 0.0248 |
| KO | 0.0284 | 0.0277 | 0.0312 | 0.0312 | 0.0292 |
| PEP | 0.0245 | 0.025 | 0.0291 | 0.0351 | 0.0392 |
Parameters
get_dividend_yield accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
show_daily | bool | Whether to show daily values: the close of each trading day against the dividends paid in the 365 calendar days up to that day (or the trailing periods in days). The prices start a year before the start date, so a window of up to a year is complete on the start date; days less than one window after a ticker’s first price are NaN. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the ratios. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
compound | bool | Whether the growth is the compound annual growth rate over the lag (e.g. lag=5 for the five-year CAGR) instead of the total change. Defaults to False. | False |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
trailing | int | The number of periods to sum flows (income and cash flow statement items) over, with balance sheet items averaged over the same number of period ends. E.g. 4 with quarterly data gives the trailing twelve months (TTM) and 3 with annual data a three-year cumulative figure. Defaults to None, which uses the trailing twelve months (4 quarters) with quarterly data and single years with annual data. | 4 |