finpandas.utils package¶
Submodules¶
finpandas.utils.errors module¶
Custom errors.
-
exception
finpandas.utils.errors.
NestedDepthError
(input_depth: int, correct_depth: int, message='iterable depth of ({input_depth}) invalid for required depth ({correct_depth})')[source]¶ Bases:
Exception
Exception raised when the inputted nested iterable is the incorrect depth
- Args:
input_depth (int): the depth of the inputted iterable correct_depth (int): the correct depth of the inputted iterable message (str, optional): printed output. Defaults to
“the nested depth of the iterable ({input_depth}) is invalid for required depth ({correct_depth})”.
-
exception
finpandas.utils.errors.
TickerNotFoundError
(ticker: str, message="inputted ticker '{ticker}' could not be found")[source]¶ Bases:
Exception
Exception raised when the inputted ticker is not found
- Args:
ticker (str): the ticker message (str, optional): printed output. Defaults to
“the inputted ticker ‘{ticker}’ could not be found”.
finpandas.utils.functional module¶
helper functions
-
class
finpandas.utils.functional.
SafeList
(iterable=(), /)[source]¶ Bases:
list
subclass of list datatype that allows safe indexing
-
finpandas.utils.functional.
count_object_methods
(obj: object)[source]¶ get the number of callable object methods
- Args:
obj (object): any object
- Returns:
int: the number of object class methods
-
finpandas.utils.functional.
get_profile_by_cik
(cik: Union[str, int]) → Union[None, Tuple[int, str, str]][source]¶ gets the company profile using the CIK number
- Args:
cik (Union[str,int]): the SEC issued Central Index Key (CIK)
- Returns:
Union[None,Tuple[int,str,str]]: (cik, ticker, title)
-
finpandas.utils.functional.
get_profile_by_ticker
(ticker: str) → Union[None, Tuple[int, str, str]][source]¶ gets the company profile using the ticker
- Args:
ticker (str): the ticker of the company
- Returns:
Union[None,Tuple[int,str,str]]: (cik, ticker, title)
-
finpandas.utils.functional.
get_profile_by_title
(title: str) → Union[None, Tuple[int, str, str], Iterable[Tuple[int, str, str]]][source]¶ gets the company profile using the title
- Args:
title (str): the company’s name in glob form
- Returns:
Union[None,Tuple[int,str,str],Iterable[Tuple[int,str,str]]]: (cik, ticker, title)
-
finpandas.utils.functional.
nested_depth
(iterable: Iterable) → int[source]¶ calculate the nested depth of an iterable
- Args:
iterable (Iterable): the iterable to calculate the depth of
- Returns:
int: the depth
-
finpandas.utils.functional.
ticker_or_cik_parser
(ticker_or_cik: Union[str, int]) → int[source]¶ takes in a ticker or CIK number and returns just the CIK number. a convenience function for internal use.
- Args:
ticker_or_cik (Union[str,int]): ticker or SEC issued Central Index Key (CIK)
- Raises:
TickerNotFoundError: if the ticker is not found in our database
- Returns:
int: the CIK number
finpandas.utils.jobs module¶
Utility for multiprocessing finpandas jobs
-
class
finpandas.utils.jobs.
Jobs
[source]¶ Bases:
object
Module contents¶
utilities