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
57 changes: 28 additions & 29 deletions fpna-template/Files/AmountType.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,41 @@
"\nXC,Claims Incurred Pattern,",
"\nXN,Claims Paid Pattern,\"",
"\n;",
"\nvar assetAmountTypes = @\"@@AssetAmountType",
"\nSystemName,DisplayName,Parent",
"\nSH,Shares,",
"\nRE,Real Estate,",
"\nCH,Cash,",
"\nBO,Bonds,",
"\nCB,CouponBond,BO",
"\nCBC,Coupon,CB",
"\nCBF,FaceValue,CB\"",
"\n;",
"\n",
"\nvar solvencyBsAmountTypes = @\"@@SolvencyBsAmountType",
"\nSystemName,DisplayName,Parent",
"\nS2A,Solvency II Assets,",
"\nS2IA,Invested Assets,S2A",
"\nS2ASH,Shares,S2A",
"\nS2ARE,Real Estate,S2A",
"\nS2ACH,Cash,S2A",
"\nS2ABO,Bonds,S2A",
"\nS2AOT,Other Assets,S2A",
"\nS2L,Solvency II Liabilities,",
"\nS2TP,Technical Provisions,S2L",
"\nS2RM,Risk Margin,S2TP",
"\nS2BEL,Best Estimate Liability,S2TP",
"\nS2OF,Own Funds,S2L",
"\nS2SCR,SCR,S2OF",
"\nS2FC,Free Capital,S2OF\"",
"\nS2LTP,Technical Provisions,S2L",
"\nS2LRM,Risk Margin,S2LTP",
"\nS2LBEL,Best Estimate Liability,S2LTP",
"\nS2LOF,Own Funds,S2L",
"\nS2LSCR,SCR,S2LOF",
"\nS2LFC,Free Capital,S2LOF\"",
"\n;",
"\nvar ifrsBsAmountTypes = @\"@@IfrsBsAmountType",
"\nSystemName,DisplayName,Parent",
"\nIFRSA,IFRS17 Assets,",
"\nIFRSIA,Invested Assets,IFRSA",
"\nIFRSOCI,Asset OCI,IFRSA",
"\nIFRSL,IFRS17 Liabilites,",
"\nIFRSBE,Best Estimate Liabilities,IFRSL",
"\nIFRSBEL,BEL Book Value,IFRSBE",
"\nIFRSBELOCI,Best Estimate Liabilities OCI,IFRSBE",
"\nIFRSRA,Risk Adjustment,IFRSL",
"\nIFRSCSM,CSM,IFRSL",
"\nIFRSEQ,Shareholders Equity,",
"\nIFRSEQOCI,Net OCI Reserve,IFRSEQ",
"\nIFRSEQRE,Retained Earnings,IFRSEQ\"",
"\nIFA,IFRS Assets,",
"\nIFASH,Shares,IFA",
"\nIFARE,Real Estate,IFA",
"\nIFACH,Cash,IFA",
"\nIFABO,Bonds,IFA",
"\nIFAOT,Other Assets,IFA",
"\nIFAOCI,Asset OCI,IFA",
"\nIFL,IFRS Liabilites,",
"\nIFLBE,Best Estimate Liabilities,IFL",
"\nIFLBEV,BEL Book Value,IFLBE",
"\nIFLBEOCI,Best Estimate Liabilities OCI,IFLBE",
"\nIFLRA,Risk Adjustment,IFL",
"\nIFLCSM,CSM,IFL",
"\nIFLEQ,Shareholders Equity,",
"\nIFLEQOCI,Net OCI Reserve,IFLEQ",
"\nIFLEQRE,Retained Earnings,IFLEQ\"",
"\n;"
],
"metadata": {},
Expand Down
56 changes: 46 additions & 10 deletions fpna-template/Files/Cashflows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,56 @@
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"cell_type": "markdown",
"source": [
"# Cashflow Definition Input"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Generic"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var basicCashflows = @\"@@BasicCashflow",
"var CashflowsDefInput = @\"",
"\n@@Main",
"\nReportingNode,Year,Month,Scenario,",
"\nCH,2020,12,,",
"\n@@BasicCashflow",
"\nDataNode,AmountType,Shape,InitialValue,Length,Shift,Values0,Values1,Values2,Values3,Values4,",
"\nG.BBA.LRC.2020.P,PR,Constant,10000,5,0,,,,,",
"\nG.BBA.LRC.2020.P,PR,Linear,1000,4,1,0.5,0.5,0.5,0.5,",
"\n@@BoundedCashflow ",
"\nDataNode,AmountType,Shape,InitialValue,Length,Shift,Minimum,Maximum",
"\nG.BBA.LRC.2020.P,PR,Random,6000,4,1,100,400",
"\n@@ReferencedCashflow",
"\nDataNode,AmountType,AccidentYear,Shape,InitialValue,Length,Shift,ReferenceAmountType,Values0,Values1,Values2,Values3,Values4",
"\nG.BBA.LRC.2020.P,PR,,Reference,,,,PR,0.5,0.5,0.5,0.5,0.5",
"\nG.BBA.LRC.2020.P,AEM,,Reference,,,,PR,-0.5,-0.5,-0.5,-0.5,-0.5",
"\nG.BBA.LRC.2020.P,CL,,Reference,,,,PR,-0.25,-0.25,-0.25,-0.25,-0.25",
"\nG.BBA.LRC.2020.P,CL,,Reference,,,,AEM,0.5,0.5,0.5,0.5,0.5",
"\nG.BBA.LRC.2020.P,S2ASH,,Reference,,,,PR,1,1,1,1,1",
"\nG.BBA.LRC.2020.P,S2LTP,,Reference,,,,PR,3,3,3,4,5",
"\n\";"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"cell_type": "markdown",
"source": [
"var boundedCashflows = @\"@@BoundedCashflow ",
"\nDataNode,AmountType,Shape,InitialValue,Length,Shift,Minimum,Maximum",
"\nG.BBA.LRC.2020.P,PR,Random,6000,4,1,100,400",
"\n\";"
"## Solvency"
],
"metadata": {},
"execution_count": 0,
Expand All @@ -44,15 +74,21 @@
{
"cell_type": "code",
"source": [
"var referencedCashflows = @\"@@ReferencedCashflow",
"var SolvencyCashflowsDefInput = @\"",
"\n@@Main",
"\nReportingNode,Year,Month,Scenario,",
"\nCH,2020,12,,",
"\n@@BasicCashflow",
"\nDataNode,AmountType,Shape,InitialValue,Length,Shift,Values0,Values1,Values2,Values3,Values4,",
"\nG.BBA.LRC.2020.P,PR,Constant,10000,5,0,,,,,",
"\nG.BBA.LRC.2020.P,PR,Linear,1000,4,1,0.5,0.5,0.5,0.5,",
"\n@@ReferencedCashflow",
"\nDataNode,AmountType,AccidentYear,Shape,InitialValue,Length,Shift,ReferenceAmountType,Values0,Values1,Values2,Values3,Values4",
"\nG.BBA.LRC.2020.P,PR,,Reference,,,,PR,0.5,0.5,0.5,0.5,0.5",
"\nG.BBA.LRC.2020.P,AEM,,Reference,,,,PR,-0.5,-0.5,-0.5,-0.5,-0.5",
"\nG.BBA.LRC.2020.P,CL,,Reference,,,,PR,-0.25,-0.25,-0.25,-0.25,-0.25",
"\nG.BBA.LRC.2020.P,CL,,Reference,,,,AEM,0.5,0.5,0.5,0.5,0.5",
"\nG.BBA.LRC.2020.P,S2TP,,Reference,,,,PR,3,3,3,4,5",
"\n\";",
"\n"
"\n\";"
],
"metadata": {},
"execution_count": 0,
Expand Down
103 changes: 103 additions & 0 deletions fpna-template/Files/RiskDriver.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"metadata": {
"authors": [],
"id": "QeoE_xy_RkWkEesq4zH7Yw",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"cell_type": "markdown",
"source": [
"# Risk Driver"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var riskDrivers = @\"@@RiskDriver",
"\nSystemName,DisplayName,Parent",
"\nT,All Risks,",
"\nADJ,Adjustments to Risk,T",
"\nOPR,Operational Risk,T",
"\nBR,Basic Risk,T",
"\nMR,Market Risk,BR",
"\nEQR,Equity,MR",
"\nPPR,Property,MR",
"\nIRR,Interest Rate,MR",
"\nSPR,Spread,MR",
"\nCUR,Currency,MR",
"\nCOR,Concentration,MR",
"\nHR,Health Insurance Risk,BR",
"\nHSR,Health Similar to Life Techniques Risk,HR",
"\nHDIS,Disability Morbidity Heath SLT Risk,HSR",
"\nHMOR,Mortality Heath SLT Risk,HSR",
"\nHLON,Longevity Heath SLT Risk,HSR",
"\nHLAP,Lapse Heath SLT Risk,HSR",
"\nHEXP,Expenses Heath SLT Risk,HSR",
"\nHREV,Revision Heath SLT Risk,HSR",
"\nHCAT,Catastrophe Heath SLT Risk,HR",
"\nHNR,Health Not Similar to Life Techniques Risk,HR",
"\nHPRR,Premium Reserve Heath NSLT Risk,HNR",
"\nHLAP,Lapse Heath NSLT Risk,HNR",
"\nLIR,Life Insurance Risk,BR",
"\nLMOR,Mortality Life Risk,LIR",
"\nLDIS,Disability Morbidity Life Risk,LIR",
"\nLLON,Longevity Life Risk,LIR",
"\nLLAP,Lapse Life Risk,LIR",
"\nLEXP,Expenses Life Risk,LIR",
"\nLREV,Revision Life Risk,LIR",
"\nLCAT,Catastrophe Life Risk,LIR",
"\nNR,Non-Life Insurance Risk,BR",
"\nNPRR,Premium Reserve Non-Life Risk,NR",
"\nNLAP,Lapse Non-Life Risk,NR",
"\nNCAT,Catastrophe Non-Life Risk,NR",
"\nDR,Counterparty Default Risk,BR",
"\nIR,Intangible Risk,BR\"",
"\n;"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Risk Driver Correlation Matrix"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var riskDriverCorrelationMatrix = @\"@@BoundedCashflow ",
"\nDataNode,RiskDriver,AmountType,Shape,InitialValue,Length,Shift,Minimum,Maximum",
"\nDT1,LIR,PPR,Costant,0.75,5,0,-1,1",
"\nDT1,LIR,LDIS,Costant,0.75,5,0,-1,1",
"\nDT1,MR,LIR,Costant,0.75,5,0,-1,1",
"\nDT1,MR,HSR,Costant,0.75,5,0,-1,1",
"\nDT1,LIR,HSR,Costant,0.75,5,0,-1,1",
"\n\";",
"\n"
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
{
"cell_type": "code",
"source": [
"var reportingNode = \"DE\";",
"\nvar year = 2022;",
"var reportingNode = \"CH\";",
"\nvar year = 2020;",
"\nvar month = 12;",
"\nvar importFormat = ImportFormats.Cashflow;",
"\nvar periodicity = Periodicity.Monthly;",
Expand Down Expand Up @@ -124,6 +124,15 @@
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"storage.CashflowDefinitions"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -203,7 +212,16 @@
"cell_type": "code",
"source": [
"var referenced = cashflowVariables.Where(x => x.Layer.Contains(\"Reference\"));",
"\nreferenced.AggregateOver()"
"\nreferenced"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# debug Solvency"
],
"metadata": {},
"execution_count": 0,
Expand All @@ -212,7 +230,38 @@
{
"cell_type": "code",
"source": [
""
"var solvencystorage = new SolvencyStorage(args, DataSource, Workspace);",
"\nawait solvencystorage.InitializeAsync();",
"\nsolvencystorage.CashflowDefinitions"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"public interface IModel : IMutableScopeWithStorage<SolvencyStorage>{}",
"\nvar solvencyUniverse = Scopes.ForStorage(solvencystorage).ToScope<IModel>();"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var solvencyIdentities = solvencystorage.Identities;"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var cashflowVariables = Scopes.ForIdentities(solvencyIdentities, solvencystorage).ToScopes<ComputeSolvency>().SelectMany(x => x.FpaVariables).ToArray();",
"\ncashflowVariables"
],
"metadata": {},
"execution_count": 0,
Expand Down
Loading