Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- Basel Exposure Adjustment Aggregator #1 (1, 2)
	- Basel Exposure Adjustment Aggregator #2 (3, 4)
	- Basel Exposure Adjustment Aggregator #3 (5, 6)
	- Basel Exposure Adjustment Aggregator #4 (7, 8)
	- Basel Exposure Adjustment Aggregator #5 (9, 10)
	- Basel Exposure Adjustment Aggregator #6 (11, 12)
	- Basel Exposure Adjustment Aggregator #7 (13, 14)
	- Basel Exposure Adjustment Aggregator #8 (15, 16)


Bug Fixes/Clean-up:

Samples:
  • Loading branch information
lakshmiDRIP committed May 23, 2018
1 parent 3f83b98 commit 55441e1
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 11 deletions.
16 changes: 16 additions & 0 deletions ReleaseNotes/05_22_2018.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Features:

- Basel Exposure Adjustment Aggregator #1 (1, 2)
- Basel Exposure Adjustment Aggregator #2 (3, 4)
- Basel Exposure Adjustment Aggregator #3 (5, 6)
- Basel Exposure Adjustment Aggregator #4 (7, 8)
- Basel Exposure Adjustment Aggregator #5 (9, 10)
- Basel Exposure Adjustment Aggregator #6 (11, 12)
- Basel Exposure Adjustment Aggregator #7 (13, 14)
- Basel Exposure Adjustment Aggregator #8 (15, 16)


Bug Fixes/Clean-up:

Samples:
59 changes: 52 additions & 7 deletions src/main/java/org/drip/xva/gross/ExposureAdjustmentAggregator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,8 @@ public org.drip.xva.gross.ExposureAdjustmentDigest digest()
/**
* Generate the Basel Exposure Digest
*
* @param standardizedExposureGeneratorScheme The Standardized Basel Exposure Generation Scheme
*
* @return The Basel Exposure Digest
*/

Expand All @@ -1235,6 +1237,7 @@ public org.drip.xva.gross.BaselExposureDigest baselExposureDigest (
int[] vertexDateArray = new int[vertexCount];
int pathCount = _pathExposureAdjustmentArray.length;
double[] collateralizedPositiveExposure = new double[vertexCount];
double[] effectiveCollateralizedPositiveExposure = new double[vertexCount];
org.drip.spline.params.SegmentCustomBuilderControl[] segmentCustomBuilderControlArray = new
org.drip.spline.params.SegmentCustomBuilderControl[vertexCount - 1];

Expand All @@ -1260,6 +1263,19 @@ public org.drip.xva.gross.BaselExposureDigest baselExposureDigest (
for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex)
{
collateralizedPositiveExposure[vertexIndex] /= pathCount;

if (0 == vertexIndex)
{
effectiveCollateralizedPositiveExposure[0] = collateralizedPositiveExposure[0];
}
else
{
effectiveCollateralizedPositiveExposure[vertexIndex] =
collateralizedPositiveExposure[vertexIndex] >
effectiveCollateralizedPositiveExposure[vertexIndex - 1] ?
collateralizedPositiveExposure[vertexIndex] :
effectiveCollateralizedPositiveExposure[vertexIndex - 1];
}
}

try
Expand All @@ -1282,9 +1298,9 @@ public org.drip.xva.gross.BaselExposureDigest baselExposureDigest (
for (int i = 0; i < vertexCount - 1; ++i)
segmentCustomBuilderControlArray[i] = segmentCustomBuilderControl;

org.drip.spline.stretch.MultiSegmentSequence multiSegmentSequence =
org.drip.spline.stretch.MultiSegmentSequence multiSegmentSequenceCollateralizedPositiveExposure =
org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator (
"DF_STRETCH",
"CollateralizedPositiveExposure",
vertexDateArray,
collateralizedPositiveExposure,
segmentCustomBuilderControlArray,
Expand All @@ -1293,12 +1309,41 @@ public org.drip.xva.gross.BaselExposureDigest baselExposureDigest (
org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE
);

org.drip.spline.stretch.MultiSegmentSequence
multiSegmentSequenceEffectiveCollateralizedPositiveExposure =
org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator (
"EffectiveCollateralizedPositiveExposure",
vertexDateArray,
effectiveCollateralizedPositiveExposure,
segmentCustomBuilderControlArray,
null,
org.drip.spline.stretch.BoundarySettings.NaturalStandard(),
org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE
);

if (null == multiSegmentSequenceCollateralizedPositiveExposure ||
null == multiSegmentSequenceEffectiveCollateralizedPositiveExposure)
{
return null;
}

int integrandFinish = vertexDateArray[0] + standardizedExposureGeneratorScheme.timeIntegrand();

double effectiveExpectedPositiveExposure =
multiSegmentSequenceEffectiveCollateralizedPositiveExposure.toAU().integrate (
vertexDateArray[0],
integrandFinish
);

return new BaselExposureDigest (
collateralizedPositiveExposure[0],
java.lang.Double.NaN, // final double expectedPositiveExposure,
java.lang.Double.NaN, // final double effectiveExpectedExposure,
java.lang.Double.NaN, // final double effectiveExpectedPositiveExposure,
java.lang.Double.NaN // final double exposureAtDefault
vertexDateArray[0],
multiSegmentSequenceCollateralizedPositiveExposure.toAU().integrate (
vertexDateArray[0],
integrandFinish
),
effectiveCollateralizedPositiveExposure[vertexCount - 1],
effectiveExpectedPositiveExposure,
effectiveExpectedPositiveExposure * standardizedExposureGeneratorScheme.eadMultiplier()
);
}
catch (java.lang.Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@

public class StandardizedExposureGeneratorScheme
{
private int _timeIntegrand = -1;
private double _eadMultiplier = java.lang.Double.NaN;
private double _timeIntegrand = java.lang.Double.NaN;

/**
* StandardizedExposureGeneratorScheme Constructor
Expand All @@ -85,11 +85,11 @@ public class StandardizedExposureGeneratorScheme

public StandardizedExposureGeneratorScheme (
final double eadMultiplier,
final double timeIntegrand)
final int timeIntegrand)
throws java.lang.Exception
{
if (!org.drip.quant.common.NumberUtil.IsValid (_eadMultiplier = eadMultiplier) ||
!org.drip.quant.common.NumberUtil.IsValid (_timeIntegrand = timeIntegrand))
0. >= _eadMultiplier || 0 >= (_timeIntegrand = timeIntegrand))
{
throw new java.lang.Exception
("StandardizedExposureGeneratorScheme Constructor => Invalid Inputs");
Expand All @@ -113,7 +113,7 @@ public double eadMultiplier()
* @return The Time Integrand
*/

public double timeIntegrand()
public int timeIntegrand()
{
return _timeIntegrand;
}
Expand Down

0 comments on commit 55441e1

Please sign in to comment.