Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gatelab.rwm.business.finanzastrutturata.engine.input.fragment;
- import java.util.Vector;
- import com.gatelab.rwm.business.finanzastrutturata.engine.utils.FSEngineConstants;
- import com.gatelab.rwm.business.finanzastrutturata.helpers.FSConfigurationReader;
- import com.gatelab.rwm.lib.exception.BusinessException;
- public class AddOnIfrs9 {
- private final double expectedLossPA1Y; /* 1 Year */
- private final double expectedLossPANPV; /* NPV */
- private final int duration;
- private FSConfigurationReader configurationReader;
- private Vector<Double> auditVector;
- public AddOnIfrs9(int duration, double expectedLossPA1Y, double expectedLossPANPV,
- FSConfigurationReader configurationReader) {
- super();
- this.duration = duration;
- this.auditVector = new Vector<Double>(duration);
- this.expectedLossPA1Y = expectedLossPA1Y;
- this.expectedLossPANPV = expectedLossPANPV;
- this.configurationReader = configurationReader;
- }
- public double applyAddon(double regulatoryCapitalNpv, AddOnInfo addInfo) throws BusinessException{
- if(addInfo.isAddon()) {
- double addon = 0d;
- double[] confValues = this.configurationReader.getAddonList(addInfo.getSegmentRegulamentarType(), addInfo.getRatingModel(), addInfo.getRating());
- double addonFactor = ( Math.abs(this.expectedLossPANPV) - Math.abs(this.expectedLossPA1Y)) / this.duration;
- for(int month=0 ; month < this.duration ; month++) {
- double addonMonthly = addonFactor * confValues[month % FSEngineConstants.MONTH_PER_YEAR];
- addon += addonMonthly;
- this.auditVector.add(addonMonthly);
- }
- regulatoryCapitalNpv += addon;
- }
- return regulatoryCapitalNpv;
- }
- @Override
- public String toString() {
- return "\n AddOnIfrs9 [expectedLossPA1Y=" + expectedLossPA1Y + ", expectedLossPANPV=" + expectedLossPANPV
- + ", duration=" + duration + " \n CalculationVector="+this.auditVector.toString()+"]\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement