fmp_py.fmp_dividends

Classes

FmpDividends

Module Contents

class fmp_py.fmp_dividends.FmpDividends(api_key: str = os.getenv('FMP_API_KEY'))

Bases: fmp_py.fmp_base.FmpBase

dividends_calendar(from_date: str, to_date: str) pandas.DataFrame

Retrieves the dividends calendar data for a specified date range. :param from_date: The starting date of the date range in “YYYY-MM-DD” format. :type from_date: str :param to_date: The ending date of the date range in “YYYY-MM-DD” format. :type to_date: str

Returns:

A DataFrame containing the dividends calendar data with the following columns:
  • date: The date of the dividend event.

  • label: The label of the dividend event.

  • adj_dividend: The adjusted dividend amount.

  • symbol: The symbol of the stock.

  • dividend: The dividend amount.

  • record_date: The record date of the dividend event.

  • payment_date: The payment date of the dividend event.

  • declaration_date: The declaration date of the dividend event.

Return type:

pd.DataFrame

Raises:

ValueError – If from_date is greater than to_date or if the request to fetch dividends calendar data fails.

dividends_historical(symbol: str) pandas.DataFrame

Fetches historical dividends data for a given stock symbol. :param symbol: The stock symbol. :type symbol: str

Returns:

A DataFrame containing the historical dividends data.

Return type:

pd.DataFrame

Raises:

ValueError – If failed to fetch historical dividends data for the given symbol.