Beispiel #1
0
    def _add_cat_xl_profiles(self, add_profiles_args):
        self.logger.debug("Adding CAT XL profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        if self.risk_level == oed.REINS_RISK_LEVEL_PORTFOLIO:
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                oed.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.OccAttachment,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                    placement=add_profiles_args.ri_info_row.PlacedPercent,
                    ceded=add_profiles_args.ri_info_row.CededPercent,
                ))
            add_profiles_args.node_layer_profile_map[(
                add_profiles_args.program_node.name,
                add_profiles_args.layer_id,
                add_profiles_args.overlay_loop)] = profile_id

        else:
            nodes_all = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == 2)

            for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
                if not self._check_scope_row(ri_scope_row, exact=False):
                    raise Exception("Unsupported filter")

                profile_id = profile_id + 1

                add_profiles_args.fmprofiles_list.append(
                    oed.get_pass_through_profile(profile_id, ))

                # Filter
                selected_nodes = self._filter_nodes(nodes_all,
                                                    ri_scope_row,
                                                    exact=False)
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id

            # add OccLimit / Placed Percent
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                oed.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.OccAttachment,
                    ceded=add_profiles_args.ri_info_row.CededPercent,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                    placement=add_profiles_args.ri_info_row.PlacedPercent,
                ))
            add_profiles_args.node_layer_profile_map[(
                add_profiles_args.program_node.name,
                add_profiles_args.layer_id,
                add_profiles_args.overlay_loop)] = profile_id
    def _add_quota_share_profiles(self, add_profiles_args):
        self.logger.debug("Adding QS profiles:")

        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)
        nodes_all = anytree.search.findall(
            add_profiles_args.program_node,
            filter_=lambda node: node.level_id == 2)

        # Add any risk limits
        # RISK LEVEL SEL
        if self.risk_level == oed.REINS_RISK_LEVEL_PORTFOLIO:
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                oed.get_reinsurance_profile(
                    profile_id,
                    limit=add_profiles_args.ri_info_row.OccLimit,
                    ceded=add_profiles_args.ri_info_row.CededPercent,
                    placement=add_profiles_args.ri_info_row.PlacedPercent))
        else:
            for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
                profile_id = profile_id + 1

                add_profiles_args.fmprofiles_list.append(
                    oed.get_reinsurance_profile(
                        profile_id,
                        limit=add_profiles_args.ri_info_row.RiskLimit,
                        ceded=add_profiles_args.ri_info_row.CededPercent,
                    ))

                # Filter
                selected_nodes = self._filter_nodes(nodes_all, ri_scope_row)
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id

        # add OccLimit / Placed Percent
        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_occlim_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.OccLimit,
                placement=add_profiles_args.ri_info_row.PlacedPercent,
            ))
        add_profiles_args.node_layer_profile_map[(
            add_profiles_args.program_node.name, add_profiles_args.layer_id,
            add_profiles_args.overlay_loop)] = profile_id
Beispiel #3
0
    def _add_fac_profiles(self, add_profiles_args):
        self.logger.debug("Adding FAC profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_reinsurance_profile(
                profile_id,
                attachment=add_profiles_args.ri_info_row.RiskAttachment,
                limit=add_profiles_args.ri_info_row.RiskLimit,
                ceded=add_profiles_args.ri_info_row.CededPercent,
                placement=add_profiles_args.ri_info_row.PlacedPercent))

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            # Note that FAC profiles scope much match the filter exactly.
            if not self._check_scope_row(ri_scope_row):
                raise Exception("Invalid scope row")
            nodes_all = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == 2)

            nodes = self._filter_nodes(nodes_all, ri_scope_row, exact=True)
            for node in nodes:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop)] = profile_id
    def _add_surplus_share_profiles(self, add_profiles_args):
        self.logger.debug("Adding SS profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)
        nodes_all = anytree.search.findall(
            add_profiles_args.program_node,
            filter_=lambda node: node.level_id == 2)

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            profile_id = profile_id + 1
            add_profiles_args.fmprofiles_list.append(
                oed.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.RiskAttachment,
                    limit=add_profiles_args.ri_info_row.RiskLimit,
                    ceded=ri_scope_row.CededPercent,
                ))

            if ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_LOCATION:
                selected_nodes = list(
                    filter(
                        lambda n: self._does_location_node_match_scope_row(
                            n, ri_scope_row), nodes_all))
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_POLICY:
                selected_nodes = list(
                    filter(
                        lambda n: self._does_policy_node_match_scope_row(
                            n, ri_scope_row), nodes_all))
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_ACCOUNT:
                selected_nodes = list(
                    filter(
                        lambda n: self._does_account_node_match_scope_row(
                            n, ri_scope_row), nodes_all))
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            else:
                raise Exception("Unsupported risk level: {}".format(
                    ri_scope_row.RiskLevel))

        # add OccLimit / Placed Percent
        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_occlim_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.OccLimit,
                placement=add_profiles_args.ri_info_row.PlacedPercent,
            ))
        add_profiles_args.node_layer_profile_map[(
            add_profiles_args.program_node.name, add_profiles_args.layer_id,
            add_profiles_args.overlay_loop)] = profile_id
    def _add_per_risk_profiles(self, add_profiles_args):
        self.logger.debug("Adding PR profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)
        nodes_all = anytree.search.findall(
            add_profiles_args.program_node,
            filter_=lambda node: node.level_id == 2)

        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_reinsurance_profile(
                profile_id,
                attachment=add_profiles_args.ri_info_row.RiskAttachment,
                limit=add_profiles_args.ri_info_row.RiskLimit,
                ceded=add_profiles_args.ri_info_row.CededPercent,
            ))

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            selected_nodes = self._filter_nodes(nodes_all, ri_scope_row)
            for node in selected_nodes:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop)] = profile_id

        # add OccLimit / Placed Percent
        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_occlim_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.OccLimit,
                placement=add_profiles_args.ri_info_row.PlacedPercent,
            ))
        add_profiles_args.node_layer_profile_map[(
            add_profiles_args.program_node.name, add_profiles_args.layer_id,
            add_profiles_args.overlay_loop)] = profile_id
Beispiel #6
0
    def _add_quota_share_profiles(self, add_profiles_args):
        self.logger.debug("Adding QS profiles:")

        profile_id = self._get_next_profile_id(add_profiles_args)
        nodes_risk_level_all = anytree.search.findall(
            add_profiles_args.program_node,
            filter_=lambda node: node.level_id == self._get_risk_level_id())
        if self.risk_level != oed.REINS_RISK_LEVEL_LOCATION:
            nodes_filter_level_all = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == self.
                _get_filter_level_id())

        add_profiles_args.fmprofiles_list.append(
            oed.get_reinsurance_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.RiskLimit,
                ceded=add_profiles_args.ri_info_row.CededPercent,
            ))

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            # Filter
            if self.risk_level != oed.REINS_RISK_LEVEL_LOCATION:
                selected_nodes = self._scope_filter(nodes_filter_level_all,
                                                    ri_scope_row,
                                                    exact=False)
                for node in selected_nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop
                    )] = add_profiles_args.passthroughprofile_id
            selected_nodes = self._risk_level_filter(nodes_risk_level_all,
                                                     ri_scope_row,
                                                     exact=False)
            for node in selected_nodes:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop)] = profile_id

        # add OccLimit / Placed Percent
        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_occlim_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.OccLimit,
                placement=add_profiles_args.ri_info_row.PlacedPercent,
            ))
        add_profiles_args.node_layer_profile_map[(
            add_profiles_args.program_node.name, add_profiles_args.layer_id,
            add_profiles_args.overlay_loop)] = profile_id
Beispiel #7
0
    def _add_surplus_share_profiles(self, add_profiles_args):
        self.logger.debug("Adding SS profiles:")
        profile_id = self._get_next_profile_id(add_profiles_args)
        nodes_risk_level_all = anytree.search.findall(
            add_profiles_args.program_node,
            filter_=lambda node: node.level_id == self._get_risk_level_id())
        if self.risk_level != oed.REINS_RISK_LEVEL_LOCATION:
            nodes_filter_level_all = anytree.search.findall(
                add_profiles_args.program_node,
                filter_=lambda node: node.level_id == self.
                _get_filter_level_id())
            for node in nodes_filter_level_all:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop
                )] = add_profiles_args.passthroughprofile_id

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            # Note that surplus share profiles scope much match the filter exactly.
            if not self._check_scope_row(ri_scope_row):
                raise OasisException(
                    "Invalid scope row: {}".format(ri_scope_row))

            add_profiles_args.fmprofiles_list.append(
                oed.get_reinsurance_profile(
                    profile_id,
                    attachment=add_profiles_args.ri_info_row.RiskAttachment,
                    limit=add_profiles_args.ri_info_row.RiskLimit,
                    ceded=ri_scope_row.CededPercent,
                ))
            selected_nodes = self._risk_level_filter(nodes_risk_level_all,
                                                     ri_scope_row,
                                                     exact=True)
            for node in selected_nodes:
                add_profiles_args.node_layer_profile_map[(
                    node.name, add_profiles_args.layer_id,
                    add_profiles_args.overlay_loop)] = profile_id
            profile_id = profile_id + 1

        # add OccLimit / Placed Percent
        add_profiles_args.fmprofiles_list.append(
            oed.get_occlim_profile(
                profile_id,
                limit=add_profiles_args.ri_info_row.OccLimit,
                placement=add_profiles_args.ri_info_row.PlacedPercent,
            ))
        add_profiles_args.node_layer_profile_map[(
            add_profiles_args.program_node.name, add_profiles_args.layer_id,
            add_profiles_args.overlay_loop)] = profile_id
    def _add_fac_profiles(self, add_profiles_args):
        self.logger.debug("Adding FAC profiles:")
        profile_id = max(x.profile_id
                         for x in add_profiles_args.fmprofiles_list)

        profile_id = profile_id + 1
        add_profiles_args.fmprofiles_list.append(
            oed.get_reinsurance_profile(
                profile_id,
                attachment=add_profiles_args.ri_info_row.RiskAttachment,
                limit=add_profiles_args.ri_info_row.RiskLimit,
                ceded=add_profiles_args.ri_info_row.CededPercent,
                placement=add_profiles_args.ri_info_row.PlacedPercent))

        for _, ri_scope_row in add_profiles_args.scope_rows.iterrows():
            if ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_LOCATION:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_location_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_POLICY:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_policy_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            elif ri_scope_row.RiskLevel == oed.REINS_RISK_LEVEL_ACCOUNT:
                nodes = anytree.search.findall(
                    add_profiles_args.program_node,
                    filter_=lambda node: self.
                    _does_account_node_match_scope_row(node, ri_scope_row))
                for node in nodes:
                    add_profiles_args.node_layer_profile_map[(
                        node.name, add_profiles_args.layer_id,
                        add_profiles_args.overlay_loop)] = profile_id
            else:
                raise Exception("Unsupported risk level: {}".format(
                    ri_scope_row.RiskLevel))