finpandas.core.datasources module
Used for analysis of public companies filing with the United States SEC.
- class Fundamentals(database: str = 'xbrl', username: str = 'finpandas', password: Optional[str] = None, _host: str = 'database-blacktip.cpeql2xeyjqq.us-east-2.rds.amazonaws.com', _port: int = 3306)
Bases:
finpandas.core.connections.DatabaseConnection
Fundamentals API
- Parameters
database (str, optional) – database to connect to. Defaults to ‘xbrl’.
- database: str = 'xbrl'
- ten_k(ticker_or_cik: Union[str, int], years: Union[int, Iterable[int]]) finpandas.dataframes.forms.Form10K
get company 10-Ks for selected years
- Parameters
ticker_or_cik (Union[str,int]) – company’s ticker or SEC issued Central Index Key (CIK)
years (Union[int,Iterable[int]]) – a year or iterable of years of interest
- Returns
a representation of the company’s 10Ks
- Return type
- ten_q(ticker_or_cik: Union[str, int], periods: Union[int, Iterable[int], Tuple[Union[str, int], Union[str, int]], Iterable[Tuple[Union[str, int], Union[str, int]]]]) finpandas.dataframes.forms.Form10Q
get company 10-Qs for selected periods
- Parameters
ticker_or_cik (Union[str,int]) – company’s ticker or SEC issued Central Index Key (CIK)
periods (Union[int,Iterable[int],Tuple[Union[str,int],Union[str,int]], Iterable[Tuple[Union[str,int],Union[str,int]]]]) – the year of interest, will get all quarters; years of interest, will get all quarters; (year, quarter) pair; (year, quarter) pairs of interest
- Raises
NestedDepthError – inputted periods is not one of the correct formats
- Returns
a representation of the company’s 10Qs
- Return type
Example
Querying 10-Q reports for Apple Inc.:
df = instance.ten_q("AAPL", 2019) df = instance.ten_q("AAPL", [2018, 2019]) df = instance.ten_q("AAPL", (2019, "q1")) df = instance.ten_q("AAPL", [(2019, "q1"), (2019, "q2")]
- class Stocks(database: str = 'stocks', username: str = 'finpandas', password: Optional[str] = None, _host: str = 'database-blacktip.cpeql2xeyjqq.us-east-2.rds.amazonaws.com', _port: int = 3306)
Bases:
finpandas.core.connections.DatabaseConnection
Stocks API
- Parameters
database (str, optional) – database to connect to. Defaults to ‘stocks’.
- database: str = 'stocks'
- price(ticker_or_cik: Union[str, int], period_start: str, period_end: Optional[str] = None) pandas.core.frame.DataFrame
queries the price of a given equity over a period
- Parameters
ticker_or_cik (Union[str,int]) – company or fund’s ticker or SEC issued Central Index Key (CIK)
period_start (str) – the starting day for the period, in year-month-day format (e.g. 2020-06-30).
period_end (str, optional) – the ending day for the period, in year-month-day format (e.g. 2020-06-30). Defaults to None, indicating a single day period_start.
- Returns
a representation of the company’s historical stock price
- Return type
pd.DataFrame
- sector(ticker_or_cik: Union[str, int]) str
queries the sector of a given entity
- Parameters
ticker_or_cik (Union[str,int]) – company or fund’s ticker or SEC issued Central Index Key (CIK)
- Returns
the sector
- Return type
str