Module pyprotolinc.product

class pyprotolinc.product.AbstractProduct(portfolio: Portfolio)

Abstract base class of the various prodduts.

STATES_MODEL

alias of AbstractStateModel

contractual_state_transitions(time_axis: TimeAxis) Iterable[tuple[pyprotolinc.models.state_models.AbstractStateModel, pyprotolinc.models.state_models.AbstractStateModel, numpy.ndarray[Any, numpy.dtype[numpy.int32]]]]

This method returns a datastructure which encodes when and for which records contractual state transitions are due.

Returns: Iterable consisting of three-tuples where
  • first member = from-state

  • sencond member = to-state

  • third member is a binary matrix of the structure “insured x time” where a “1” represents a contractual move.

get_bom_payments(time_axis: TimeAxis) dict[pyprotolinc.models.state_models.AbstractStateModel, list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

Return the ‘conditional payments’, i.e. those payments that are due if an insured is in the corresponding state at the given time.

get_state_transition_payments(time_axis: TimeAxis) dict[tuple[pyprotolinc.models.state_models.AbstractStateModel, pyprotolinc.models.state_models.AbstractStateModel], list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

This method returns a datastructure which encodes which state stransitions trigger which payments

Returns: Dictionary mapping StateTransitions parametrized by tuples of the State-Enum to a binary matrix of the structure “insured x time”.

class pyprotolinc.product.Product_AnnuityInPayment(portfolio: Portfolio)

Simple product that pays out the sum_insured / 12 each month.

STATES_MODEL

alias of AnnuityRunoffStates

get_bom_payments(time_axis: TimeAxis) dict[pyprotolinc.models.state_models.AbstractStateModel, list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

Return the ‘conditional payments’, i.e. those payments that are due if an insured is in the corresponding state at the given time.

class pyprotolinc.product.Product_AnnuityInPaymentYearlyAtBirthMonth(portfolio: Portfolio)

Simple product that pays out the sum_insured each year at the month of birth.

STATES_MODEL

alias of AnnuityRunoffStates

get_bom_payments(time_axis: TimeAxis) dict[pyprotolinc.models.state_models.AbstractStateModel, list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

Return the ‘conditional payments’, i.e. those payments that are due if an insured is in the corresponding state at the given time.

class pyprotolinc.product.Product_MortalityTerm(portfolio: Portfolio)

Simple product that pays out on death.

STATES_MODEL

alias of MortalityStates

contractual_state_transitions(time_axis: TimeAxis) Iterable[tuple[pyprotolinc.models.state_models.AbstractStateModel, pyprotolinc.models.state_models.AbstractStateModel, numpy.ndarray[Any, numpy.dtype[numpy.int32]]]]

This method returns a datastructure which encodes when and for which records contractual state transitions are due.

Returns: Iterable consisting of three-tuples where
  • first member = from-state

  • sencond member = to-state

  • third member is a binary matrix of the structure “insured x time” where a “1” represents a contractual move.

get_bom_payments(time_axis: TimeAxis) dict[pyprotolinc.models.state_models.AbstractStateModel, list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

Return the ‘conditional payments’, i.e. those payments that are due if an insured is in the corresponding state at the given time.

get_state_transition_payments(time_axis: TimeAxis) dict[tuple[pyprotolinc.models.state_models.AbstractStateModel, pyprotolinc.models.state_models.AbstractStateModel], list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

This method returns a datastructure which encodes which state stransitions trigger which payments

Returns: Dictionary mapping StateTransitions parametrized by tuples of the State-Enum to a binary matrix of the structure “insured x time”.

class pyprotolinc.product.Product_TwoStateDisability(portfolio: Portfolio)

Income protection product with two disabled states.

STATES_MODEL

alias of MultiStateDisabilityStates

get_bom_payments(time_axis: TimeAxis) dict[pyprotolinc.models.state_models.AbstractStateModel, list[tuple[pyprotolinc.results.CfNames, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]]]

Return the ‘conditional payments’, i.e. those payments that are due if an insured is in the corresponding state at the given time.

pyprotolinc.product.calc_maturity_transition_indicator(time_axis: TimeAxis, year_last_month: ndarray[Any, dtype[int32]], last_month: ndarray[Any, dtype[int32]]) ndarray[Any, dtype[int32]]

Calculate a binary matrix with - rows corresponing to insureds - columns corresponding to time such that the entry is “1” only in the last month of the policy lifetime.

pyprotolinc.product.calc_term_end_indicator(time_axis: TimeAxis, year_last_month: ndarray[Any, dtype[int32]], last_month: ndarray[Any, dtype[int32]]) ndarray[Any, dtype[int16]]

Calculate a binary matrix with - rows corresponing to insureds - columns corresponding to time such that the entry is “1” for all times before the policy matures. The input is given by a time-axis object and two numpy arrays which are indexed by insured and together represent the last month/year at which the policy ist still in-force.

pyprotolinc.product.calc_term_start_indicator(time_axis: TimeAxis, inception_yr: ndarray[Any, dtype[int16]], inception_month: ndarray[Any, dtype[int16]]) ndarray[Any, dtype[int16]]

Calculate a binary matrix with - rows corresponing to insureds - columns corresponding to time such that the entry is “1” for all times after the policy term begins. The input is given by a time-axis object and two numpy arrays which are indexed by insured and together represent the last month/year at which the policy ist still in-force.

pyprotolinc.product.calc_terminal_months(df_portfolio: DataFrame) tuple[numpy.ndarray[Any, numpy.dtype[numpy.int32]], numpy.ndarray[Any, numpy.dtype[numpy.int32]]]

Calculate the final month of the policy given a term in years as input. The method shortens policy durations when they started not on the first of a month.

pyprotolinc.product.register(cls: type[pyprotolinc.product.AbstractProduct]) type[pyprotolinc.product.AbstractProduct]

Annotation that will register the product.

pyprotolinc.product.show_products() list[tuple[str, type[pyprotolinc.product.AbstractProduct], Optional[str]]]

Return a list containing all registered product. The list items are tuples constiting of the product name, the class and the doc-string.