Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ifrs17/Import/2ImportScope-PresentValue.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"\n private string EconomicBasis => GetContext();",
"\n ",
"\n private double[] YearlyYieldCurve => EconomicBasis switch {",
"\n EconomicBases.N => Enumerable.Empty<double>().ToArray(),",
"\n EconomicBases.N => new [] { 0d },",
"\n _ => GetStorage().GetYearlyYieldCurve(Identity, EconomicBasis),",
"\n };",
"\n ",
Expand Down
19 changes: 9 additions & 10 deletions ifrs17/Import/5ImportScope-ToIfrsVar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@
"\n",
"\n private string economicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;",
"\n private IEnumerable<string> amountTypesForTm => GetScope<TechnicalMarginAmountType>((Identity, EstimateTypes.C)).Values;",
"\n private bool hasTechnicalMargin => GetStorage().ImportFormat switch {",
"\n ImportFormats.Cashflow => GetStorage().GetRawVariables(Identity.DataNode).Any(x => x.EstimateType == EstimateTypes.RA || ",
"\n (x.EstimateType == EstimateTypes.BE && amountTypesForTm.Contains(x.AmountType))),",
"\n _ => GetStorage().GetIfrsVariables(Identity.DataNode).Any(x => !GetStorage().EstimateTypesByImportFormat[ImportFormats.Actual].Contains(x.EstimateType) && ",
"\n amountTypesForTm.Contains(x.AmountType))",
"\n };",
"\n // TODO: we need to think how to define the logic on when to compute LC for PAA-LRC",
"\n // private bool hasTechnicalMargin => GetStorage().ImportFormat switch {",
Comment thread
dtrzesniak marked this conversation as resolved.
"\n // ImportFormats.Cashflow => GetStorage().GetRawVariables(Identity.DataNode).Any(x => x.EstimateType == EstimateTypes.RA || ",
"\n // (x.EstimateType == EstimateTypes.BE && amountTypesForTm.Contains(x.AmountType))),",
"\n // _ => GetStorage().GetIfrsVariables(Identity.DataNode).Any(x => !GetStorage().EstimateTypesByImportFormat[ImportFormats.Actual].Contains(x.EstimateType) && ",
"\n // amountTypesForTm.Contains(x.AmountType))",
"\n // };",
"\n",
"\n IEnumerable<IfrsVariable> Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC || Identity.ValuationApproach == ValuationApproaches.PAA",
"\n ? Enumerable.Empty<IfrsVariable>()",
Expand All @@ -456,8 +457,7 @@
"\n Partition = GetStorage().TargetPartition",
"\n });",
"\n",
"\n IEnumerable<IfrsVariable> Loss => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC ||",
"\n (Identity.ValuationApproach == ValuationApproaches.PAA && !hasTechnicalMargin )",
"\n IEnumerable<IfrsVariable> Loss => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC",
"\n ? Enumerable.Empty<IfrsVariable>()",
"\n : Identity.IsReinsurance ",
"\n ? GetScope<LossRecoveryComponent>(Identity).RepeatOnce()",
Expand All @@ -480,8 +480,7 @@
"\n });",
"\n ",
"\n IEnumerable<IfrsVariable> AmortizationFactor => Identity.AocType == AocTypes.AM && Loss.Concat(Csms).Where(x => x.Values != null).Any(x => Math.Abs(x.Values.GetValidElement(Identity.ProjectionPeriod)) > Precision)",
"\n && GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LRC && ",
"\n (Identity.ValuationApproach != ValuationApproaches.PAA || hasTechnicalMargin )",
"\n && GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LRC",
"\n ? GetScope<CurrentPeriodAmortizationFactor>((Identity, AmountTypes.CU, 0), o => o.WithContext(economicBasis)).RepeatOnce()",
"\n .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,",
"\n DataNode = x.Identity.Id.DataNode,",
Expand Down
31 changes: 29 additions & 2 deletions ifrs17/Report/ReportScopes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
"source": [
"public interface BestEstimate: IScope<(ReportIdentity Id, CurrencyType CurrencyType), ReportStorage>, IDataCube<ReportVariable> {",
"\n IDataCube<ReportVariable> BestEstimate => Identity.Id switch {",
"\n { ValuationApproach: ValuationApproaches.PAA } => GetScope<LockedBestEstimate>(Identity).LockedBestEstimate, //TODO we should use the economic basis driver to decide which Economic basis to use",
"\n { ValuationApproach: ValuationApproaches.BBA, IsOci: true } => GetScope<LockedBestEstimate>(Identity).LockedBestEstimate,",
"\n _ => GetScope<CurrentBestEstimate>(Identity).CurrentBestEstimate };",
"\n}",
Expand All @@ -281,6 +282,11 @@
"\npublic interface CurrentBestEstimate: IScope<(ReportIdentity Id, CurrencyType CurrencyType), ReportStorage>, IDataCube<ReportVariable> {",
"\n IDataCube<ReportVariable> CurrentBestEstimate => GetScope<FxData>((Identity.Id, Identity.CurrencyType, EstimateTypes.BE)).FxData",
"\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.C), (\"AmountType\", \"!CDRI\"));",
"\n}",
"\n",
"\npublic interface NominalBestEstimate: IScope<(ReportIdentity Id, CurrencyType CurrencyType), ReportStorage>, IDataCube<ReportVariable> {",
"\n IDataCube<ReportVariable> NominalBestEstimate => GetScope<FxData>((Identity.Id, Identity.CurrencyType, EstimateTypes.BE)).FxData",
"\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.N), (\"AmountType\", \"!CDRI\"));",
"\n}"
],
"metadata": {},
Expand Down Expand Up @@ -583,7 +589,11 @@
"\n}",
"\n",
"\npublic interface LrcActuarialPaa: LrcActuarial{",
"\n IDataCube<ReportVariable> LrcActuarial.LrcActuarial => -1d * GetScope<Revenues>(Identity).Revenues + GetScope<Deferrals>(Identity).Deferrals + Loreco;",
"\n IDataCube<ReportVariable> LrcActuarial.LrcActuarial => -1d * GetScope<Revenues>(Identity).Revenues + -1d * GetScope<Deferrals>(Identity).Deferrals + Loreco",
"\n + GetScope<BestEstimate>(Identity).BestEstimate",
"\n .Where(x => GetStorage().GetHierarchy<AmountType>().Ancestors(x.AmountType, includeSelf: true).Any(x => x.SystemName == AmountTypes.PR) ||",
"\n GetStorage().GetHierarchy<AmountType>().Ancestors(x.AmountType, includeSelf: true).Any(x => x.SystemName == AmountTypes.DE))",
"\n .ToDataCube();",
"\n}"
],
"metadata": {},
Expand Down Expand Up @@ -1433,6 +1443,14 @@
"\n private IDataCube<ReportVariable> CsmAmortization => -1 * GetScope<Csm>(Identity).Csm",
"\n .Filter((\"VariableType\", AocTypes.AM))",
"\n .SelectToDataCube(v => v with { VariableType = \"ISE22\" });",
"\n",
"\n // Acquistion Expenses Release (Amortization)",
"\n private IDataCube<ReportVariable> AcquistionExpensesAmortization => Identity.Id switch {",
"\n { ValuationApproach: ValuationApproaches.PAA } => Enumerable.Empty<ReportVariable>().ToArray().ToDataCube(),",
"\n _ => -1 * GetScope<Deferrals>(Identity)",
"\n .Filter((\"VariableType\", AocTypes.AM))",
"\n .SelectToDataCube(v => v with { VariableType = \"ISE22\" })",
"\n }; ",
"\n ",
"\n // Loss Recovery Component (Amortization)",
"\n private IDataCube<ReportVariable> Loreco => GetScope<Loreco>(Identity).Loreco.Filter((\"VariableType\", \"!BOP\"),(\"VariableType\", \"!EOP\")) +",
Expand All @@ -1453,6 +1471,15 @@
"\n .AggregateOver(nameof(Novelty), nameof(VariableType))",
"\n .SelectToDataCube(v => v with { Novelty = Novelties.C, VariableType = \"ISE11\" });",
"\n",
"\n // PAA Premiums",
"\n private IDataCube<ReportVariable> Revenues => GetScope<Revenues>(Identity).Revenues.Filter((\"VariableType\", \"AM\"));",
"\n",
"\n private IDataCube<ReportVariable> PaaPremiums => Identity.Id switch {",
"\n { ValuationApproach: ValuationApproaches.PAA } => Revenues",
"\n .SelectToDataCube(v => v with { Novelty = Novelties.C, VariableType = \"ISE201\" }),",
"\n _ => Enumerable.Empty<ReportVariable>().ToArray().ToDataCube()",
"\n };",
"\n",
"\n // Experience Adjustment On Premiums",
"\n private IDataCube<ReportVariable> ReinsuranceActualPremiums => Identity.Id switch {",
"\n { ValuationApproach: ValuationApproaches.PAA } => Enumerable.Empty<ReportVariable>().ToArray().ToDataCube(),",
Expand Down Expand Up @@ -1497,7 +1524,7 @@
"\n .SelectToDataCube(rv => rv with { Novelty = Novelties.C, VariableType = \"ISE24\"});",
"\n",
"\n // Reinsurance",
"\n IDataCube<ReportVariable> InsuranceServiceExpense.Reinsurance => ExpectedClaims + ExpectedClaimsInvestmentComponent + ExpectedExpenses + ExpectedCommissions + RaRelease + CsmAmortization + LorecoAmortization + LorecoNonFinancialChanges + LorecoFinancialChanges + ExperienceAdjustmentOnPremiums + NonFinancialFcfDeltasCorrection;",
"\n IDataCube<ReportVariable> InsuranceServiceExpense.Reinsurance => ExpectedClaims + ExpectedClaimsInvestmentComponent + ExpectedExpenses + ExpectedCommissions + RaRelease + CsmAmortization + AcquistionExpensesAmortization + LorecoAmortization + LorecoNonFinancialChanges + LorecoFinancialChanges + PaaPremiums + ExperienceAdjustmentOnPremiums + NonFinancialFcfDeltasCorrection;",
"\n}",
"\n"
],
Expand Down
3 changes: 1 addition & 2 deletions ifrs17/Utils/ImportCalculationMethods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"public static double[] ComputeDiscountAndCumulate(this double[] nominalValues, double[] monthlyDiscounting, PeriodType periodType) ",
"\n{ ",
"\n if(nominalValues == null) return Enumerable.Empty<double>().ToArray();",
"\n if(!monthlyDiscounting.Any()) monthlyDiscounting = new double[]{1d}; //Empty discounting array triggers Cumulation. ",
"\n",
"\n ",
"\n var ret = new double[nominalValues.Length];",
"\n ",
"\n if(periodType == PeriodType.BeginningOfPeriod)",
Expand Down