Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
	- IR Class Sensitivity Settings - Shell (1)
	- IR Class Sensitivity Settings Delta (2)
	- IR Class Sensitivity Settings Vega (3)
	- IR Class Sensitivity Settings Constructor (4, 5, 6)
	- SIMM IR Sensitivity Margin Aggregate (7, 8)
	- Vega Aggregate Margin Bucket Map (12, 13)
	- Core Vega SBA Margin Variance (14, 15)
	- Residual Vega SBA Margin Variance (16, 17)
	- Risk Class SBA Vega Margin (18)
	- Risk Class Margin Aggregate #1 (19, 20)
	- Risk Class Margin Aggregate #2 (21, 22)
	- Risk Measure EQ Delta Settings (23, 24)
	- Equity Vega Sensitivity Settings Parameter (26, 27, 28)
	- Commodity Vega Sensitivity Settings Parameter (29, 30)
	- ISDA FX Vega Settings #1 (32, 33, 34)
	- ISDA FX Vega Settings #2 (35, 36, 37)
	- IR Risk Weight Tenor Delta (38, 39)
	- IR Weight Tenor Delta Vega (40, 41)
	- Tenor Vega Risk Weight #1 (42, 43)
	- Tenor Vega Risk Weight #2 (44)
	- IR ISDA Bucket Delta Settings (47)
	- IR ISDA Bucket Vega Settings (48, 49)
	- SIMM Bucket Vega Settings Shell (50)
	- SIMM Bucket Vega Risk Weight (51)
	- SIMM Bucket Vega Member Correlation (52)
	- SIMM Bucket Vega Implied Volatility (53)
	- SIMM Bucket Vega Settings Constructor (54, 55, 56)
	- Bucket Vega Raw Risk Weight (57)
	- Bucket Vega Settings Sensitivity Inheritance (58, 59)


Bug Fixes/Clean-up:

	- Risk Factor Aggregate IR Margin (9)
	- Risk Class Bucket Delta Aggregate (10, 11)
	- Tenor Delta Weight Low Volatility (45, 46)


Samples:

	- EQ Delta Initial Margin (25)
	- CT Delta Initial Margin (31)
  • Loading branch information
lakshmiDRIP committed Sep 10, 2018
1 parent 619fbf6 commit 014e248
Show file tree
Hide file tree
Showing 21 changed files with 906 additions and 132 deletions.
45 changes: 45 additions & 0 deletions ReleaseNotes/08_16_2018.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Features:

- IR Class Sensitivity Settings - Shell (1)
- IR Class Sensitivity Settings Delta (2)
- IR Class Sensitivity Settings Vega (3)
- IR Class Sensitivity Settings Constructor (4, 5, 6)
- SIMM IR Sensitivity Margin Aggregate (7, 8)
- Vega Aggregate Margin Bucket Map (12, 13)
- Core Vega SBA Margin Variance (14, 15)
- Residual Vega SBA Margin Variance (16, 17)
- Risk Class SBA Vega Margin (18)
- Risk Class Margin Aggregate #1 (19, 20)
- Risk Class Margin Aggregate #2 (21, 22)
- Risk Measure EQ Delta Settings (23, 24)
- Equity Vega Sensitivity Settings Parameter (26, 27, 28)
- Commodity Vega Sensitivity Settings Parameter (29, 30)
- ISDA FX Vega Settings #1 (32, 33, 34)
- ISDA FX Vega Settings #2 (35, 36, 37)
- IR Risk Weight Tenor Delta (38, 39)
- IR Weight Tenor Delta Vega (40, 41)
- Tenor Vega Risk Weight #1 (42, 43)
- Tenor Vega Risk Weight #2 (44)
- IR ISDA Bucket Delta Settings (47)
- IR ISDA Bucket Vega Settings (48, 49)
- SIMM Bucket Vega Settings Shell (50)
- SIMM Bucket Vega Risk Weight (51)
- SIMM Bucket Vega Member Correlation (52)
- SIMM Bucket Vega Implied Volatility (53)
- SIMM Bucket Vega Settings Constructor (54, 55, 56)
- Bucket Vega Raw Risk Weight (57)
- Bucket Vega Settings Sensitivity Inheritance (58, 59)


Bug Fixes/Clean-up:

- Risk Factor Aggregate IR Margin (9)
- Risk Class Bucket Delta Aggregate (10, 11)
- Tenor Delta Weight Low Volatility (45, 46)


Samples:

- EQ Delta Initial Margin (25)
- CT Delta Initial Margin (31)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import org.drip.quant.common.FormatUtil;
import org.drip.service.env.EnvManager;
import org.drip.simm20.margin.IRDeltaAggregate;
import org.drip.simm20.margin.IRSensitivityAggregate;
import org.drip.simm20.margin.RiskClassAggregateIR;
import org.drip.simm20.parameters.RiskMeasureSensitivitySettingsIR;
import org.drip.simm20.product.BucketSensitivityIR;
Expand Down Expand Up @@ -263,7 +263,7 @@ private static final void DisplayRiskClassAggregate (

private static final void DeltaMarginCovarianceEntry (
final String currency,
final IRDeltaAggregate irDeltaAggregate)
final IRSensitivityAggregate irDeltaAggregate)
throws Exception
{
double marginCovariance_OIS_OIS = irDeltaAggregate.marginCovariance_OIS_OIS();
Expand Down Expand Up @@ -542,7 +542,7 @@ public static final void main (

DeltaMarginCovarianceEntry (
currency,
riskClassAggregateIR.bucketAggregateMap().get (currency).irDeltaAggregate()
riskClassAggregateIR.deltaBucketAggregateMap().get (currency).irDeltaAggregate()
);

DisplayRiskClassAggregate (riskClassAggregateIR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.drip.quant.common.FormatUtil;
import org.drip.service.env.EnvManager;
import org.drip.simm20.margin.BucketAggregateIR;
import org.drip.simm20.margin.IRDeltaAggregate;
import org.drip.simm20.margin.IRSensitivityAggregate;
import org.drip.simm20.margin.RiskClassAggregateIR;
import org.drip.simm20.parameters.BucketSensitivitySettingsIR;
import org.drip.simm20.product.BucketSensitivityIR;
Expand Down Expand Up @@ -229,7 +229,7 @@ private static final void DisplayBucketSensitivityIR (
}

private static final void DeltaMarginCovarianceEntry (
final IRDeltaAggregate irDeltaAggregate)
final IRSensitivityAggregate irDeltaAggregate)
throws Exception
{
double marginCovariance_OIS_OIS = irDeltaAggregate.marginCovariance_OIS_OIS();
Expand Down Expand Up @@ -502,7 +502,7 @@ public static final void main (
double notional = 100.;
String currency = "USD";

BucketSensitivitySettingsIR bucketSensitivitySettingsIR = BucketSensitivitySettingsIR.ISDA
BucketSensitivitySettingsIR bucketSensitivitySettingsIR = BucketSensitivitySettingsIR.ISDA_DELTA
(currency);

BucketSensitivityIR bucketSensitivityIR = new BucketSensitivityIR (
Expand All @@ -519,7 +519,7 @@ public static final void main (

BucketAggregateIR bucketAggregateIR = bucketSensitivityIR.aggregate (bucketSensitivitySettingsIR);

IRDeltaAggregate irDeltaAggregate = bucketAggregateIR.riskFactorAggregateIR().deltaMargin
IRSensitivityAggregate irDeltaAggregate = bucketAggregateIR.riskFactorAggregateIR().margin
(bucketSensitivitySettingsIR);

DeltaMarginCovarianceEntry (irDeltaAggregate);
Expand All @@ -533,7 +533,10 @@ public static final void main (

RiskClassAggregateIR riskClassAggregateIR = new RiskClassAggregateIR (
bucketAggregateIRMap,
null,
irDeltaAggregate.cumulativeMarginCovariance(),
0.,
0.,
0.
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import org.drip.quant.common.FormatUtil;
import org.drip.service.env.EnvManager;
import org.drip.simm20.margin.IRDeltaAggregate;
import org.drip.simm20.margin.IRSensitivityAggregate;
import org.drip.simm20.margin.RiskClassAggregateIR;
import org.drip.simm20.parameters.RiskMeasureSensitivitySettingsIR;
import org.drip.simm20.product.BucketSensitivityIR;
Expand Down Expand Up @@ -233,7 +233,7 @@ private static final void DisplayBucketSensitivityIR (

private static final void DeltaMarginCovarianceEntry (
final String currency,
final IRDeltaAggregate irDeltaAggregate)
final IRSensitivityAggregate irDeltaAggregate)
throws Exception
{
double marginCovariance_OIS_OIS = irDeltaAggregate.marginCovariance_OIS_OIS();
Expand Down Expand Up @@ -574,7 +574,7 @@ public static final void main (
{
DeltaMarginCovarianceEntry (
currency,
riskClassAggregateIR.bucketAggregateMap().get (currency).irDeltaAggregate()
riskClassAggregateIR.deltaBucketAggregateMap().get (currency).irDeltaAggregate()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static final void RegularVolatility()

String tenorWeightSequence = "\t|| ";

for (Map.Entry<String, Double> tenorWeightEntry : usdRiskWeight.tenorWeightMap().entrySet())
for (Map.Entry<String, Double> tenorWeightEntry : usdRiskWeight.tenorDelta().entrySet())
{
tenorWeightSequence = tenorWeightSequence + " " + tenorWeightEntry.getKey() + " => " +
FormatUtil.FormatDouble (tenorWeightEntry.getValue(), 1, 0, 1.) + " |";
Expand Down Expand Up @@ -142,7 +142,7 @@ private static final void LowVolatility()

String tenorWeightSequence = "\t|| ";

for (Map.Entry<String, Double> tenorWeightEntry : jpyRiskWeight.tenorWeightMap().entrySet())
for (Map.Entry<String, Double> tenorWeightEntry : jpyRiskWeight.tenorDelta().entrySet())
{
tenorWeightSequence = tenorWeightSequence + " " + tenorWeightEntry.getKey() + " => " +
FormatUtil.FormatDouble (tenorWeightEntry.getValue(), 1, 0, 1.) + " |";
Expand Down Expand Up @@ -179,7 +179,7 @@ private static final void HighVolatility()

String tenorWeightSequence = "\t|| ";

for (Map.Entry<String, Double> tenorWeightEntry : inrRiskWeight.tenorWeightMap().entrySet())
for (Map.Entry<String, Double> tenorWeightEntry : inrRiskWeight.tenorDelta().entrySet())
{
tenorWeightSequence = tenorWeightSequence + " " + tenorWeightEntry.getKey() + " => " +
FormatUtil.FormatDouble (tenorWeightEntry.getValue(), 1, 0, 1.) + " |";
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/drip/simm20/margin/BucketAggregateIR.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
public class BucketAggregateIR
{
private double _sensitivityMarginVariance = java.lang.Double.NaN;
private org.drip.simm20.margin.IRDeltaAggregate _irDeltaAggregate = null;
private org.drip.simm20.margin.IRSensitivityAggregate _irDeltaAggregate = null;
private double _cumulativeRiskFactorSensitivityMargin = java.lang.Double.NaN;
private org.drip.simm20.margin.RiskFactorAggregateIR _riskFactorAggregateIR = null;

Expand All @@ -89,7 +89,7 @@ public class BucketAggregateIR

public BucketAggregateIR (
final org.drip.simm20.margin.RiskFactorAggregateIR riskFactorAggregateIR,
final org.drip.simm20.margin.IRDeltaAggregate irDeltaAggregate,
final org.drip.simm20.margin.IRSensitivityAggregate irDeltaAggregate,
final double sensitivityMarginVariance,
final double cumulativeRiskFactorSensitivityMargin)
throws java.lang.Exception
Expand Down Expand Up @@ -122,7 +122,7 @@ public org.drip.simm20.margin.RiskFactorAggregateIR riskFactorAggregateIR()
* @return The IR Delta Aggregate
*/

public org.drip.simm20.margin.IRDeltaAggregate irDeltaAggregate()
public org.drip.simm20.margin.IRSensitivityAggregate irDeltaAggregate()
{
return _irDeltaAggregate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
*/

/**
* IRDeltaAggregate holds the IM Delta Margin Co-variances within a single Currency for each of the IR Risk
* Factors - OIS, LIBOR 1M, LIBOR 3M, LIBOR 6M LIBOR 12M, PRIME, and MUNICIPAL. The References are:
* IRSensitivityAggregate holds the IM Margin Sensitivity Co-variances within a single Currency for each of
* the IR Risk Factors - OIS, LIBOR 1M, LIBOR 3M, LIBOR 6M LIBOR 12M, PRIME, and MUNICIPAL. The References
* are:
*
* - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin,
* https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN.
Expand All @@ -69,7 +70,7 @@
* @author Lakshmi Krishnamurthy
*/

public class IRDeltaAggregate
public class IRSensitivityAggregate
{
private double _marginCovariance_OIS_OIS = java.lang.Double.NaN;
private double _marginCovariance_OIS_PRIME = java.lang.Double.NaN;
Expand Down Expand Up @@ -109,6 +110,8 @@ public class IRDeltaAggregate
private double _cumulativeMarginSensitivity = java.lang.Double.NaN;

/**
* IRSensitivityAggregate Constructor
*
* @param marginCovariance_OIS_OIS The OIS - OIS Margin Co-variance
* @param marginCovariance_OIS_LIBOR1M The OIS - LIBOR1M Margin Co-variance
* @param marginCovariance_OIS_LIBOR3M The OIS - LIBOR3M Margin Co-variance
Expand Down Expand Up @@ -142,7 +145,7 @@ public class IRDeltaAggregate
* @throws java.lang.Exception Thrown if the Inputs are Invalid
*/

public IRDeltaAggregate (
public IRSensitivityAggregate (
final double marginCovariance_OIS_OIS,
final double marginCovariance_OIS_LIBOR1M,
final double marginCovariance_OIS_LIBOR3M,
Expand Down Expand Up @@ -233,7 +236,7 @@ public IRDeltaAggregate (
!org.drip.quant.common.NumberUtil.IsValid (_cumulativeMarginSensitivity =
cumulativeMarginSensitivity))
{
throw new java.lang.Exception ("IRDeltaAggregate Constructor => Invalid Inputs");
throw new java.lang.Exception ("IRSensitivityAggregate Constructor => Invalid Inputs");
}
}

Expand Down
83 changes: 72 additions & 11 deletions src/main/java/org/drip/simm20/margin/RiskClassAggregate.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,72 @@

public class RiskClassAggregate
{
private double _coreVegaSBAVariance = java.lang.Double.NaN;
private double _coreDeltaSBAVariance = java.lang.Double.NaN;
private double _residualVegaSBAVariance = java.lang.Double.NaN;
private double _residualDeltaSBAVariance = java.lang.Double.NaN;
private java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> _bucketAggregateMap =
private java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> _vegaBucketAggregateMap =
null;
private java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> _deltaBucketAggregateMap =
null;

/**
* RiskClassAggregate Constructor
*
* @param bucketAggregateMap The Bucket Aggregate Map
* @param deltaBucketAggregateMap The Delta Bucket Aggregate Map
* @param vegaBucketAggregateMap The Vega Bucket Aggregate Map
* @param coreDeltaSBAVariance The SBA Based Risk Class Core Delta Variance
* @param coreVegaSBAVariance The SBA Based Risk Class Core Vega Variance
* @param residualDeltaSBAVariance The SBA Based Risk Class Residual Delta Variance
* @param residualVegaSBAVariance The SBA Based Risk Class Residual Vega Variance
*
* @throws java.lang.Exception Thrown if the Inputs are Invalid
*/

public RiskClassAggregate (
final java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> bucketAggregateMap,
final java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate>
deltaBucketAggregateMap,
final java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate>
vegaBucketAggregateMap,
final double coreDeltaSBAVariance,
final double residualDeltaSBAVariance)
final double coreVegaSBAVariance,
final double residualDeltaSBAVariance,
final double residualVegaSBAVariance)
throws java.lang.Exception
{
if (null == (_bucketAggregateMap = bucketAggregateMap) || 0 == _bucketAggregateMap.size() ||
!org.drip.quant.common.NumberUtil.IsValid (_coreDeltaSBAVariance = coreDeltaSBAVariance) ||
!org.drip.quant.common.NumberUtil.IsValid (_residualDeltaSBAVariance = residualDeltaSBAVariance))
if (!org.drip.quant.common.NumberUtil.IsValid (_coreDeltaSBAVariance = coreDeltaSBAVariance) ||
!org.drip.quant.common.NumberUtil.IsValid (_coreVegaSBAVariance = coreVegaSBAVariance) ||
!org.drip.quant.common.NumberUtil.IsValid (_residualDeltaSBAVariance = residualDeltaSBAVariance)
||
!org.drip.quant.common.NumberUtil.IsValid (_residualVegaSBAVariance = residualVegaSBAVariance))
{
throw new java.lang.Exception ("RiskClassAggregate Constructor => Invalid Inputs");
}

_vegaBucketAggregateMap = vegaBucketAggregateMap;
_deltaBucketAggregateMap = deltaBucketAggregateMap;
}

/**
* Retrieve the Bucket Aggregate Map
* Retrieve the Delta Bucket Aggregate Map
*
* @return The Bucket Aggregate Map
* @return The Delta Bucket Aggregate Map
*/

public java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> bucketAggregateMap()
public java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> deltaBucketAggregateMap()
{
return _bucketAggregateMap;
return _deltaBucketAggregateMap;
}

/**
* Retrieve the Vega Bucket Aggregate Map
*
* @return The Vega Bucket Aggregate Map
*/

public java.util.Map<java.lang.String, org.drip.simm20.margin.BucketAggregate> vegaBucketAggregateMap()
{
return _vegaBucketAggregateMap;
}

/**
Expand All @@ -122,6 +150,17 @@ public double coreDeltaSBAVariance()
return _coreDeltaSBAVariance;
}

/**
* Retrieve the Risk Class Core Vega Margin Variance
*
* @return The Risk Class Core Vega Margin Variance
*/

public double coreVegaSBAVariance()
{
return _coreVegaSBAVariance;
}

/**
* Retrieve the Risk Class Residual Delta Margin Variance
*
Expand All @@ -133,6 +172,17 @@ public double residualDeltaSBAVariance()
return _residualDeltaSBAVariance;
}

/**
* Retrieve the Risk Class Residual Vega Margin Variance
*
* @return The Risk Class Residual Vega Margin Variance
*/

public double residualVegaSBAVariance()
{
return _residualVegaSBAVariance;
}

/**
* Retrieve the Risk Class SBA Based Delta Margin
*
Expand All @@ -143,4 +193,15 @@ public double deltaSBA()
{
return java.lang.Math.sqrt (_coreDeltaSBAVariance) + java.lang.Math.sqrt (_residualDeltaSBAVariance);
}

/**
* Retrieve the Risk Class SBA Based Vega Margin
*
* @return The Risk Class SBA Based Vega Margin
*/

public double vegaSBA()
{
return java.lang.Math.sqrt (_coreVegaSBAVariance) + java.lang.Math.sqrt (_residualVegaSBAVariance);
}
}
Loading

0 comments on commit 014e248

Please sign in to comment.