financialdatapy.stock module

This module retrieves financial data of a stock.

class financialdatapy.stock.Stock(symbol: str, country_code: str = 'USA')[source]

Bases: object

A class representing a stock or a company.

Parameters:
  • symbol (str) – Symbol of a company/stock.

  • country_code (str, optional) – Country where the stock is listed. The format should follow alpha-3 code (ISO 3166), defaults to ‘USA’.

property symbol: str

Getter method of property symbol.

Returns:

Symbol of a company/stock.

Return type:

str

property country_code: str

Getter method of property country_code.

Returns:

Country code

Return type:

str

property market: Market

Property of market.Market instance.

Returns:

market.Market instance.

Return type:

market.Market

financials(financial: str = 'income_statement', period: str = 'annual', is_standard: bool = False, web: bool = False) → DataFrame | None[source]

Get financial statements as reported.

Parameters:
  • financial (str, optional) – Which financial statement to retrieve. Input string should be either ‘income_statement’, ‘balance_sheet’, or ‘cash_flow’, defaults to ‘income_statement’

  • period (str, optional) – Either ‘annual’ or ‘quarter’, defaults to ‘annual’.

  • is_standard (bool, optional) – Option for retrieving standard financial statements, defaults to False.

  • web (bool, optional) – Option for opening filings in a web browser, defaults to False.

Returns:

Financial statement as reported.

Return type:

pandas.DataFrame

price(start: str | None = None, end: str | None = None) → DataFrame[source]

Get historical stock price data.

Parameters:
  • start (str, optional) – Start date to query. Format should be in ISO 8601, defaults to None.

  • end (str, optional) – End date to query. Format should be in ISO 8601, defaults to None.

Returns:

Historical stock price data.

Return type:

pandas.DataFrame