From b9ec317e2cc01538290c32f8c24d6dc542036820 Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Mon, 26 Feb 2018 18:53:31 -0500 Subject: [PATCH] Features: - Close Out Scheme Settings - Shell (1) - Close Out Scheme Settings - Bilateral (2) - Close Out Scheme Settings - ISDA (3) - Close Out Scheme Settings #1 (4, 5) - Close Out Scheme Settings #2 (6, 7) - Close Out Scheme Settings #3 (8, 9) - XVA Hypothecation Collateral Group Shell (10, 11) - XVA Hypothecation Collateral Group Specification (12, 13) - Collateral Group Broken Date Interpolator (14, 15, 16) - XVA Hypothecation Collateral Group Trajectory (17, 18) - Collateral Group Market Vertex Array (19) - Collateral Group Position Value Array (20) - Collateral Group Broken Date Interpolator (21) - XVA Hypothecation Collateral Balance #1 (22, 23) - XVA Hypothecation Collateral Balance #2 (24, 25) - Position Group Vertex Array Values (26, 27) - Position Group Collateral Balance Array (28, 29) - Position Collateral Group Vertex #1 (30, 31) - Position Collateral Group Vertex #2 (32, 33) - Market Vertex Close Out Bilateral (34, 35, 36) - Collateral Group Vertex Array Call (37, 38) - Collateral Group Constructor and Annotation (39, 40, 41) - Position Vertex Group Collateral Array (42) - XVA Dynamics Path Simulator #1 (45, 46) - XVA Dynamics Path Simulator #2 (47, 48) - XVA Dynamics Path Simulator #3 (49, 50) Bug Fixes/Clean-up: - Close Out Market Edge Fix (51) - Eliminate Path Broken Date Scheme (52) - Eliminate Path Hedge Error Scheme (53) - Eliminate Path Close Out Scheme (54) - Eliminate Path Position Replication Scheme (55) - Eliminate Path Adjustment Digest Scheme (56, 57) - Eliminate XVA Path Simulator Scheme (58) Samples: - Albanese Andersen Basel Proxy (43, 44) --- ReleaseNotes/03_08_2018.txt | 45 ++ ...rfectReplicationCollateralizedFunding.java | 2 +- ...cationCollateralizedFundingStochastic.java | 2 +- ...erfectReplicationZeroThresholdFunding.java | 2 +- ...icationZeroThresholdFundingStochastic.java | 2 +- .../SemiReplicationCollateralizedFunding.java | 2 +- ...cationCollateralizedFundingStochastic.java | 2 +- .../SemiReplicationZeroThresholdFunding.java | 2 +- ...icationZeroThresholdFundingStochastic.java | 2 +- .../SetOffCollateralizedFunding.java | 2 +- ...SetOffCollateralizedFundingStochastic.java | 2 +- .../SetOffZeroThresholdFunding.java | 2 +- .../SetOffZeroThresholdFundingStochastic.java | 2 +- .../xva/CollateralizedCollateralGroup.java | 2 +- ...llateralizedCollateralGroupCorrelated.java | 2 +- .../xva/PortfolioCollateralEstimate.java | 2 +- .../xva/ZeroThresholdCollateralGroup.java | 2 +- ...eroThresholdCollateralGroupCorrelated.java | 2 +- .../CollateralizedCollateralNeutral.java | 2 +- ...ateralizedCollateralNeutralStochastic.java | 2 +- .../CollateralizedCollateralPayable.java | 2 +- ...ateralizedCollateralPayableStochastic.java | 2 +- .../CollateralizedCollateralReceivable.java | 2 +- ...ralizedCollateralReceivableStochastic.java | 2 +- .../CollateralizedFundingNeutral.java | 2 +- ...ollateralizedFundingNeutralStochastic.java | 2 +- .../CollateralizedFundingPayable.java | 2 +- ...ollateralizedFundingPayableStochastic.java | 2 +- .../CollateralizedFundingReceivable.java | 2 +- ...ateralizedFundingReceivableStochastic.java | 2 +- .../CollateralizedNettingNeutral.java | 2 +- ...ollateralizedNettingNeutralStochastic.java | 2 +- .../CollateralizedNettingPayable.java | 2 +- ...ollateralizedNettingPayableStochastic.java | 2 +- .../CollateralizedNettingReceivable.java | 2 +- ...ateralizedNettingReceivableStochastic.java | 2 +- .../ZeroThresholdCollateralNeutral.java | 2 +- ...oThresholdCollateralNeutralStochastic.java | 2 +- .../ZeroThresholdCollateralPayable.java | 2 +- ...oThresholdCollateralPayableStochastic.java | 2 +- .../ZeroThresholdCollateralReceivable.java | 2 +- ...resholdCollateralReceivableStochastic.java | 2 +- .../xvabasel/ZeroThresholdFundingNeutral.java | 2 +- ...ZeroThresholdFundingNeutralStochastic.java | 2 +- .../xvabasel/ZeroThresholdFundingPayable.java | 2 +- ...ZeroThresholdFundingPayableStochastic.java | 2 +- .../ZeroThresholdFundingReceivable.java | 2 +- ...oThresholdFundingReceivableStochastic.java | 2 +- .../xvabasel/ZeroThresholdNettingNeutral.java | 2 +- ...ZeroThresholdNettingNeutralStochastic.java | 2 +- .../xvabasel/ZeroThresholdNettingPayable.java | 2 +- ...ZeroThresholdNettingPayableStochastic.java | 2 +- .../ZeroThresholdNettingReceivable.java | 2 +- ...oThresholdNettingReceivableStochastic.java | 2 +- .../sample/xvadigest/CPGACollateralized.java | 2 +- .../CPGACollateralizedCorrelated.java | 2 +- .../sample/xvadigest/CPGAZeroThreshold.java | 2 +- .../CPGAZeroThresholdCorrelated.java | 2 +- .../AlbaneseAndersenBaselProxy.java | 5 +- .../xva/definition/CloseOutBilateral.java | 31 ++ .../org/drip/xva/dynamics/PathSimulator.java | 275 +----------- .../xva/hypothecation/CollateralGroup.java | 401 ++++++++++++++++++ .../xva/set/CollateralGroupSpecification.java | 10 +- .../org/drip/xva/settings/CloseOutScheme.java | 83 ++++ .../xva/settings/PathSimulatorScheme.java | 189 --------- 65 files changed, 645 insertions(+), 508 deletions(-) create mode 100644 ReleaseNotes/03_08_2018.txt create mode 100644 src/main/java/org/drip/xva/hypothecation/CollateralGroup.java create mode 100644 src/main/java/org/drip/xva/settings/CloseOutScheme.java delete mode 100644 src/main/java/org/drip/xva/settings/PathSimulatorScheme.java diff --git a/ReleaseNotes/03_08_2018.txt b/ReleaseNotes/03_08_2018.txt new file mode 100644 index 000000000000..79a4064ed9bb --- /dev/null +++ b/ReleaseNotes/03_08_2018.txt @@ -0,0 +1,45 @@ + +Features: + + - Close Out Scheme Settings - Shell (1) + - Close Out Scheme Settings - Bilateral (2) + - Close Out Scheme Settings - ISDA (3) + - Close Out Scheme Settings #1 (4, 5) + - Close Out Scheme Settings #2 (6, 7) + - Close Out Scheme Settings #3 (8, 9) + - XVA Hypothecation Collateral Group Shell (10, 11) + - XVA Hypothecation Collateral Group Specification (12, 13) + - Collateral Group Broken Date Interpolator (14, 15, 16) + - XVA Hypothecation Collateral Group Trajectory (17, 18) + - Collateral Group Market Vertex Array (19) + - Collateral Group Position Value Array (20) + - Collateral Group Broken Date Interpolator (21) + - XVA Hypothecation Collateral Balance #1 (22, 23) + - XVA Hypothecation Collateral Balance #2 (24, 25) + - Position Group Vertex Array Values (26, 27) + - Position Group Collateral Balance Array (28, 29) + - Position Collateral Group Vertex #1 (30, 31) + - Position Collateral Group Vertex #2 (32, 33) + - Market Vertex Close Out Bilateral (34, 35, 36) + - Collateral Group Vertex Array Call (37, 38) + - Collateral Group Constructor and Annotation (39, 40, 41) + - Position Vertex Group Collateral Array (42) + - XVA Dynamics Path Simulator #1 (45, 46) + - XVA Dynamics Path Simulator #2 (47, 48) + - XVA Dynamics Path Simulator #3 (49, 50) + + +Bug Fixes/Clean-up: + + - Close Out Market Edge Fix (51) + - Eliminate Path Broken Date Scheme (52) + - Eliminate Path Hedge Error Scheme (53) + - Eliminate Path Close Out Scheme (54) + - Eliminate Path Position Replication Scheme (55) + - Eliminate Path Adjustment Digest Scheme (56, 57) + - Eliminate XVA Path Simulator Scheme (58) + + +Samples: + + - Albanese Andersen Basel Proxy (43, 44) diff --git a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFunding.java b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFunding.java index 89191087258f..2f7b5daff645 100644 --- a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFunding.java @@ -212,7 +212,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFundingStochastic.java index ddd634dd5484..ddeb72b4a641 100644 --- a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationCollateralizedFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFunding.java b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFunding.java index e0563765c5f4..9435ccd1b5e7 100644 --- a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFunding.java @@ -212,7 +212,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFundingStochastic.java index 9cecb6ae49c2..0107e7d06999 100644 --- a/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/PerfectReplicationZeroThresholdFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFunding.java b/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFunding.java index b3841e626b41..ebeb303e5fc4 100644 --- a/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFunding.java @@ -212,7 +212,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFundingStochastic.java index 8effd1bd29da..f17d05d07c8c 100644 --- a/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/SemiReplicationCollateralizedFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFunding.java b/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFunding.java index 1a7dd08e8ac8..d082b09cd1f9 100644 --- a/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFunding.java @@ -212,7 +212,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFundingStochastic.java index 3bc125e80b6c..b2e21cbb3fe0 100644 --- a/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/SemiReplicationZeroThresholdFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFunding.java b/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFunding.java index 7a8bcd11f90c..1cd678236883 100644 --- a/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFunding.java @@ -211,7 +211,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFundingStochastic.java index 55f185fbfda3..a85465804da3 100644 --- a/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/SetOffCollateralizedFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFunding.java b/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFunding.java index 2dd8e4b9b2b8..0687b814739e 100644 --- a/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFunding.java +++ b/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFunding.java @@ -211,7 +211,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); CloseOut cog = new CloseOutBilateral ( diff --git a/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFundingStochastic.java b/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFundingStochastic.java index 0b059a77707a..c7f4a5927fc2 100644 --- a/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFundingStochastic.java +++ b/src/main/java/org/drip/sample/burgard2013/SetOffZeroThresholdFundingStochastic.java @@ -323,7 +323,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.BILATERAL ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroup.java b/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroup.java index 75014f45415a..cd59bb51371c 100644 --- a/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroup.java +++ b/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroup.java @@ -213,7 +213,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( diff --git a/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java b/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java index 83e95951715f..1dd45d0f7423 100644 --- a/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java +++ b/src/main/java/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java @@ -285,7 +285,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double dblTimeWidth = dblTime / iNumStep; diff --git a/src/main/java/org/drip/sample/xva/PortfolioCollateralEstimate.java b/src/main/java/org/drip/sample/xva/PortfolioCollateralEstimate.java index e041798e12bb..b6cbc8b00e11 100644 --- a/src/main/java/org/drip/sample/xva/PortfolioCollateralEstimate.java +++ b/src/main/java/org/drip/sample/xva/PortfolioCollateralEstimate.java @@ -112,7 +112,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver dePortfolio = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroup.java b/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroup.java index ea140761bc3b..014a43e63e8b 100644 --- a/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroup.java +++ b/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroup.java @@ -211,7 +211,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( diff --git a/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java b/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java index 683dbee04062..b762a47fb085 100644 --- a/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java +++ b/src/main/java/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java @@ -283,7 +283,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double dblTimeWidth = dblTime / iNumStep; diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutral.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutral.java index 406c1d997a8f..016b0f0a7550 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutralStochastic.java index ea557047b361..005089a36279 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralNeutralStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayable.java index b02bc786228a..7e5278f0a40f 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayableStochastic.java index 2fd91c249fec..287f747c0771 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralPayableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivable.java index e438c6acae5a..05c44d6d1977 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivableStochastic.java index ff115f6c5e06..3e0cd2e5f142 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedCollateralReceivableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutral.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutral.java index c3131c7c49e2..8f9c786ec5ab 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutralStochastic.java index dcb8aeb921a0..c8111a4e56d5 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingNeutralStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayable.java index 93d1feb8f13f..741df6c8351a 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayableStochastic.java index 044ef4ea97b9..e2f904e8bb18 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingPayableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivable.java index 786f2ad8940b..793185bcd860 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivableStochastic.java index f22cb19b2027..c9019a9c292d 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedFundingReceivableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutral.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutral.java index 2b80571dce59..a790fe56f808 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutralStochastic.java index ca3476cb7cb1..560f0ec90767 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingNeutralStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayable.java index 94384cf91282..6918b793741f 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayableStochastic.java index 7030bda50312..dccdee251c8c 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingPayableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivable.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivable.java index ded2c345fbae..9d4cb9917822 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivableStochastic.java index 45a23bd9515f..5802efc868fa 100644 --- a/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/CollateralizedNettingReceivableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutral.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutral.java index 5b95cda5ac45..ba7c27204473 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutralStochastic.java index 618ee4535baf..9979e166cbc6 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralNeutralStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayable.java index ec415b27e5aa..191741870463 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayableStochastic.java index 498140a8cec7..f0118cac3527 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralPayableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivable.java index 17ec3457aa6c..2f51ef5fad11 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivableStochastic.java index 39f71b09c6d0..eb59f496ed09 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdCollateralReceivableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutral.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutral.java index b6bff32f8a75..f4a67f41d70f 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutralStochastic.java index f1505c47a09d..33b4a2090c73 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingNeutralStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayable.java index a3ad92ba1b75..499660d36037 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayableStochastic.java index b14e4086c31d..f50558ede338 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingPayableStochastic.java @@ -315,7 +315,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivable.java index 4c5b302fc7ed..4d1dc4162689 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivableStochastic.java index 2a5371620653..23d54ef70220 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdFundingReceivableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutral.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutral.java index db2c265637de..0bc636d876c7 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutral.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutral.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutralStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutralStochastic.java index 97fa0ce921de..93d936637921 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutralStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingNeutralStochastic.java @@ -315,7 +315,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayable.java index af6f81013430..c49f67b2a57d 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayable.java @@ -208,7 +208,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayableStochastic.java index 0cafabb0f967..80268d820bd0 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingPayableStochastic.java @@ -314,7 +314,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivable.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivable.java index 27874edf2763..dd016524213a 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivable.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivable.java @@ -209,7 +209,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( diff --git a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivableStochastic.java b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivableStochastic.java index 06698057c252..0da98fb1425f 100644 --- a/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivableStochastic.java +++ b/src/main/java/org/drip/sample/xvabasel/ZeroThresholdNettingReceivableStochastic.java @@ -313,7 +313,7 @@ private static final ExposureAdjustmentAggregator[] Mix ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); JulianDate dtSpot = DateUtil.Today(); diff --git a/src/main/java/org/drip/sample/xvadigest/CPGACollateralized.java b/src/main/java/org/drip/sample/xvadigest/CPGACollateralized.java index 29460a66c162..e9064496782e 100644 --- a/src/main/java/org/drip/sample/xvadigest/CPGACollateralized.java +++ b/src/main/java/org/drip/sample/xvadigest/CPGACollateralized.java @@ -280,7 +280,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( diff --git a/src/main/java/org/drip/sample/xvadigest/CPGACollateralizedCorrelated.java b/src/main/java/org/drip/sample/xvadigest/CPGACollateralizedCorrelated.java index d5911b597a2c..e78911abe867 100644 --- a/src/main/java/org/drip/sample/xvadigest/CPGACollateralizedCorrelated.java +++ b/src/main/java/org/drip/sample/xvadigest/CPGACollateralizedCorrelated.java @@ -352,7 +352,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.LINEAR_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double dblTimeWidth = dblTime / iNumStep; diff --git a/src/main/java/org/drip/sample/xvadigest/CPGAZeroThreshold.java b/src/main/java/org/drip/sample/xvadigest/CPGAZeroThreshold.java index e87f81ba721a..920205498ea4 100644 --- a/src/main/java/org/drip/sample/xvadigest/CPGAZeroThreshold.java +++ b/src/main/java/org/drip/sample/xvadigest/CPGAZeroThreshold.java @@ -278,7 +278,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( diff --git a/src/main/java/org/drip/sample/xvadigest/CPGAZeroThresholdCorrelated.java b/src/main/java/org/drip/sample/xvadigest/CPGAZeroThresholdCorrelated.java index ec2ef93ad2f2..656d28c14b85 100644 --- a/src/main/java/org/drip/sample/xvadigest/CPGAZeroThresholdCorrelated.java +++ b/src/main/java/org/drip/sample/xvadigest/CPGAZeroThresholdCorrelated.java @@ -350,7 +350,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ); double dblTimeWidth = dblTime / iNumStep; diff --git a/src/main/java/org/drip/sample/xvafixfloat/AlbaneseAndersenBaselProxy.java b/src/main/java/org/drip/sample/xvafixfloat/AlbaneseAndersenBaselProxy.java index 5f5fcc7b0b39..56ce3ac205cc 100644 --- a/src/main/java/org/drip/sample/xvafixfloat/AlbaneseAndersenBaselProxy.java +++ b/src/main/java/org/drip/sample/xvafixfloat/AlbaneseAndersenBaselProxy.java @@ -452,7 +452,7 @@ public static final void main ( bank, counterParty ), - PathSimulatorScheme.AlbaneseAndersenVertex(), + AdjustmentDigestScheme.ALBANESE_ANDERSEN_METRICS_POINTER, PositionGroupContainer.Solo ( new PositionGroup ( new PositionGroupSpecification ( @@ -465,7 +465,7 @@ public static final void main ( PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, BrokenDateScheme.SQUARE_ROOT_OF_TIME, 0., - null + CloseOutScheme.ISDA_92 ), new NettingGroupSpecification ( "NETGRPSPEC1", @@ -499,7 +499,6 @@ public static final void main ( PathExposureAdjustment[] pathExposureAdjustmentArray = new PathExposureAdjustment[iNumPath]; CorrelatedPathVertexDimension correlatedPathVertexDimension = new CorrelatedPathVertexDimension ( - // LinearCongruentialGenerator.NumericalRecipes (MultipleRecursiveGeneratorLEcuyer.MRG32k3a()), new RandomNumberGenerator(), correlationMatrix, eventCount, diff --git a/src/main/java/org/drip/xva/definition/CloseOutBilateral.java b/src/main/java/org/drip/xva/definition/CloseOutBilateral.java index 29abef0f82ca..e0a895f780f7 100644 --- a/src/main/java/org/drip/xva/definition/CloseOutBilateral.java +++ b/src/main/java/org/drip/xva/definition/CloseOutBilateral.java @@ -72,6 +72,37 @@ public class CloseOutBilateral extends org.drip.xva.definition.CloseOut private double _counterPartyRecovery = java.lang.Double.NaN;; private double _bankSeniorFundingRecovery = java.lang.Double.NaN; + /** + * Generate the Close Out Bilateral Instance from the Market Vertex + * + * @param marketVertex The Market Vertex Instance + * + * @return The Close Out Bilateral Instance from the Market Vertex + */ + + public static final CloseOutBilateral Market ( + final org.drip.xva.universe.MarketVertex marketVertex) + { + if (null == marketVertex) + { + return null; + } + + try + { + return new CloseOutBilateral ( + marketVertex.bank().seniorRecoveryRate(), + marketVertex.counterParty().seniorRecoveryRate() + ); + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + } + + return null; + } + /** * CloseOutBilateral Constructor * diff --git a/src/main/java/org/drip/xva/dynamics/PathSimulator.java b/src/main/java/org/drip/xva/dynamics/PathSimulator.java index 039c8bb88ac9..62c9c73f3e99 100644 --- a/src/main/java/org/drip/xva/dynamics/PathSimulator.java +++ b/src/main/java/org/drip/xva/dynamics/PathSimulator.java @@ -69,7 +69,7 @@ public class PathSimulator { private int _iCount = -1; - private org.drip.xva.settings.PathSimulatorScheme _simulatorScheme = null; + private int _adjustmentDigestScheme = -1; private org.drip.xva.universe.MarketVertexGenerator _marketVertexGenerator = null; private org.drip.xva.holdings.PositionGroupContainer _positionGroupContainer = null; @@ -106,264 +106,30 @@ private double[][] positionGroupValueArray ( return positionGroupValueArray; } - private org.drip.measure.bridge.BrokenDateInterpolator brokenDateInterpolator ( - final org.drip.xva.universe.MarketVertex[] marketVertexArray, - final double[] positionGroupValueArray, - final int vertexIndex) - throws java.lang.Exception - { - int brokenDateScheme = _simulatorScheme.brokenDateScheme(); - - if (org.drip.xva.settings.BrokenDateScheme.LINEAR_TIME == brokenDateScheme) - { - return 0 == vertexIndex ? null : new org.drip.measure.bridge.BrokenDateInterpolatorLinearT ( - marketVertexArray[vertexIndex - 1].anchorDate().julian(), - marketVertexArray[vertexIndex].anchorDate().julian(), - positionGroupValueArray[vertexIndex - 1], - positionGroupValueArray[vertexIndex] - ); - } - - if (org.drip.xva.settings.BrokenDateScheme.SQUARE_ROOT_OF_TIME == brokenDateScheme) - { - return 0 == vertexIndex ? null : new org.drip.measure.bridge.BrokenDateInterpolatorSqrtT ( - marketVertexArray[vertexIndex - 1].anchorDate().julian(), - marketVertexArray[vertexIndex].anchorDate().julian(), - positionGroupValueArray[vertexIndex - 1], - positionGroupValueArray[vertexIndex] - ); - } - - if (org.drip.xva.settings.BrokenDateScheme.THREE_POINT_BROWNIAN_BRIDGE == brokenDateScheme) - { - return 0 == vertexIndex || 1 == vertexIndex ? null : new - org.drip.measure.bridge.BrokenDateInterpolatorBrownian3P ( - marketVertexArray[vertexIndex - 2].anchorDate().julian(), - marketVertexArray[vertexIndex - 1].anchorDate().julian(), - marketVertexArray[vertexIndex].anchorDate().julian(), - positionGroupValueArray[vertexIndex - 2], - positionGroupValueArray[vertexIndex - 1], - positionGroupValueArray[vertexIndex] - ); - } - - return null; - } - - private double collateralBalance ( - final org.drip.xva.universe.MarketVertex[] marketVertexArray, - final org.drip.xva.holdings.PositionGroup positionGroup, - final int vertexIndex) - throws java.lang.Exception - { - double[] positionGroupValueArray = positionGroup.valueArray (marketVertexArray); - - org.drip.measure.bridge.BrokenDateInterpolator brokenDateInterpolator = brokenDateInterpolator ( - marketVertexArray, - positionGroupValueArray, - vertexIndex - ); - - org.drip.xva.set.PositionGroupSpecification positionGroupSpecification = - positionGroup.positionGroupSpecification(); - - return null == brokenDateInterpolator ? 0. : new org.drip.xva.hypothecation.CollateralAmountEstimator - (positionGroupSpecification.collateralGroupSpecification(), - brokenDateInterpolator ( - marketVertexArray, - positionGroupValueArray, - vertexIndex - ), - java.lang.Double.NaN - ).postingRequirement (marketVertexArray[vertexIndex].anchorDate()); - } - - private double[][] collateralBalanceArray ( - final org.drip.xva.universe.MarketVertex[] marketVertexArray, - final double[][] positionGroupValueArray) + private boolean collateralGroupPathArray ( + final org.drip.xva.universe.MarketPath marketPath) { - org.drip.xva.holdings.PositionGroup[] positionGroupArray = - _positionGroupContainer.positionGroupArray(); - - int vertexCount = marketVertexArray.length; - int positionGroupCount = positionGroupValueArray.length; - double[][] collateralBalanceArray = new double[positionGroupCount][vertexCount]; - - for (int positionGroupIndex = 0; positionGroupIndex < positionGroupCount; ++positionGroupIndex) - { - for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) - { - try - { - collateralBalanceArray[positionGroupIndex][vertexIndex] = collateralBalance ( - marketVertexArray, - positionGroupArray[positionGroupIndex], - vertexIndex - ); - } - catch (java.lang.Exception e) - { - e.printStackTrace(); + org.drip.xva.hypothecation.CollateralGroup collateralGroup = null; - return null; - } - } - } - - return collateralBalanceArray; - } - - private org.drip.xva.hypothecation.CollateralGroupVertex collateralGroupVertex ( - final org.drip.analytics.date.JulianDate anchorDate, - final double positionGroupValue, - final double realizedCashFlow, - final double collateralBalance, - final org.drip.xva.universe.MarketEdge marketEdge) - { - int positionReplicationScheme = _simulatorScheme.positionReplicationScheme(); + org.drip.xva.universe.MarketVertex[] marketVertexArray = marketPath.vertexes(); try { - if (org.drip.xva.settings.PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX == - positionReplicationScheme) - { - return new org.drip.xva.hypothecation.AlbaneseAndersenVertex ( - anchorDate, - positionGroupValue, - realizedCashFlow, - collateralBalance - ); - } - - if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX == - positionReplicationScheme) - { - return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.HedgeErrorDualBond ( - anchorDate, - positionGroupValue, - realizedCashFlow, - collateralBalance, - _simulatorScheme.hedgeError(), - marketEdge, - _simulatorScheme.closeOutScheme() - ); - } - - if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX - == positionReplicationScheme) - { - return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.SemiReplicationDualBond ( - anchorDate, - positionGroupValue, - realizedCashFlow, - collateralBalance, - marketEdge, - _simulatorScheme.closeOutScheme() - ); - } - - if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_GOLD_PLATED_TWO_WAY_CSA_VERTEX - == positionReplicationScheme) - { - return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.GoldPlatedTwoWayCSA ( - anchorDate, - positionGroupValue, - realizedCashFlow, - marketEdge, - _simulatorScheme.closeOutScheme() - ); - } - - if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_ONE_WAY_CSA_VERTEX == - positionReplicationScheme) - { - return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.OneWayCSA ( - anchorDate, - positionGroupValue, - realizedCashFlow, - marketEdge, - _simulatorScheme.closeOutScheme() - ); - } - - if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX == - positionReplicationScheme) - { - return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.SetOff ( - anchorDate, - positionGroupValue, - realizedCashFlow, - collateralBalance, - marketEdge - ); - } + collateralGroup = new org.drip.xva.hypothecation.CollateralGroup ( + _positionGroupContainer.positionGroupArray()[0].positionGroupSpecification().collateralGroupSpecification(), + marketVertexArray, + positionGroupValueArray (marketVertexArray) + ); } catch (java.lang.Exception e) { e.printStackTrace(); - } - return null; - } - - private org.drip.xva.hypothecation.CollateralGroupVertex[][] collateralGroupVertexArray ( - final org.drip.xva.universe.MarketVertex[] marketVertexArray, - final double[][] positionGroupValueArray) - { - double[][] collateralBalanceArray = collateralBalanceArray ( - marketVertexArray, - positionGroupValueArray - ); - - if (null == collateralBalanceArray) - { - return null; - } - - int vertexCount = marketVertexArray.length; - int positionGroupCount = positionGroupValueArray.length; - org.drip.xva.hypothecation.CollateralGroupVertex[][] collateralGroupVertexArray = new - org.drip.xva.hypothecation.CollateralGroupVertex[positionGroupCount][vertexCount]; - - for (int positionGroupIndex = 0; positionGroupIndex < positionGroupCount; ++positionGroupIndex) - { - for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) - { - try - { - collateralGroupVertexArray[positionGroupIndex][vertexIndex] = collateralGroupVertex ( - marketVertexArray[vertexIndex].anchorDate(), - positionGroupValueArray[positionGroupIndex][vertexIndex], - 0., - collateralBalanceArray[positionGroupIndex][vertexIndex], - 0 == vertexIndex ? null : new org.drip.xva.universe.MarketEdge ( - marketVertexArray[vertexIndex - 1], - marketVertexArray[vertexIndex] - ) - ); - } - catch (java.lang.Exception e) - { - e.printStackTrace(); - - return null; - } - } + return false; } - return collateralGroupVertexArray; - } - - private boolean collateralGroupPathArray ( - final org.drip.xva.universe.MarketPath marketPath) - { - org.drip.xva.universe.MarketVertex[] marketVertexArray = marketPath.vertexes(); - org.drip.xva.hypothecation.CollateralGroupVertex[][] collateralGroupVertexArray = - collateralGroupVertexArray ( - marketVertexArray, - positionGroupValueArray (marketVertexArray) - ); + collateralGroup.positionGroupVertexArray(); if (null == collateralGroupVertexArray) { @@ -413,7 +179,7 @@ public static final PathSimulator UnitPositionGroupValue ( return new PathSimulator ( iPathCount, marketVertexGenerator, - org.drip.xva.settings.PathSimulatorScheme.AlbaneseAndersenVertex(), + org.drip.xva.settings.AdjustmentDigestScheme.ALBANESE_ANDERSEN_METRICS_POINTER, positionGroupContainer ); } @@ -439,17 +205,18 @@ public static final PathSimulator UnitPositionGroupValue ( public PathSimulator ( final int iCount, final org.drip.xva.universe.MarketVertexGenerator marketVertexGenerator, - final org.drip.xva.settings.PathSimulatorScheme simulatorScheme, + final int adjustmentDigestScheme, final org.drip.xva.holdings.PositionGroupContainer positionGroupContainer) throws java.lang.Exception { if (0 >= (_iCount = iCount) || null == (_marketVertexGenerator = marketVertexGenerator) || - null == (_simulatorScheme = simulatorScheme) || null == (_positionGroupContainer = positionGroupContainer)) { throw new java.lang.Exception ("PathSimulator Constructor => Invalid Inputs"); } + + _adjustmentDigestScheme = adjustmentDigestScheme; } /** @@ -475,14 +242,14 @@ public org.drip.xva.universe.MarketVertexGenerator marketVertexGenerator() } /** - * Retrieve the Path Simulator Scheme + * Retrieve the Adjustment Digest Scheme * - * @return The Path Simulator Scheme + * @return The Adjustment Digest Scheme */ - public org.drip.xva.settings.PathSimulatorScheme scheme() + public int adjustmentDigestScheme() { - return _simulatorScheme; + return _adjustmentDigestScheme; } /** @@ -537,7 +304,7 @@ public org.drip.xva.cpty.PathExposureAdjustment singleTrajectory ( org.drip.xva.strategy.AlbaneseAndersenNettingGroupPath[positionCreditDebtGroupCount]; if (org.drip.xva.settings.AdjustmentDigestScheme.ALBANESE_ANDERSEN_METRICS_POINTER == - _simulatorScheme.adjustmentDigestScheme()) + _adjustmentDigestScheme) { for (int positionFundingGroupIndex = 0; positionFundingGroupIndex < positionFundingGroupCount; ++positionFundingGroupIndex) diff --git a/src/main/java/org/drip/xva/hypothecation/CollateralGroup.java b/src/main/java/org/drip/xva/hypothecation/CollateralGroup.java new file mode 100644 index 000000000000..3033957c5c0f --- /dev/null +++ b/src/main/java/org/drip/xva/hypothecation/CollateralGroup.java @@ -0,0 +1,401 @@ + +package org.drip.xva.hypothecation; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2018 Lakshmi Krishnamurthy + * + * This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model + * libraries targeting analysts and developers + * https://lakshmidrip.github.io/DRIP/ + * + * DRIP is composed of four main libraries: + * + * - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ + * - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ + * - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ + * - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ + * + * - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, + * Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA + * Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV + * Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM + * Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. + * + * - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy + * Incorporator, Holdings Constraint, and Transaction Costs. + * + * - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. + * + * - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CollateralGroup generates the Customized Collateral Group Trajectories. The References are:

+ * + * - Burgard, C., and M. Kjaer (2013): Funding Strategies, Funding Costs Risk 24 (12) + * 82-87.

+ * + * - Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party Risk + * and Funding Costs Journal of Credit Risk 7 (3) 1-19.

+ * + * - Burgard, C., and M. Kjaer (2014): In the Balance Risk 24 (11) 72-75.

+ * + * - Albanese, C., L. Andersen, and, S. Iabichino (2015): The FVA Puzzle: Accounting, Risk Management, and + * Collateral Trading https://papers.ssrn.com/sol3/paper.cfm?abstract_id_2517301

+ * + * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing + * Risk 21 (2) 97-102.

+ * + * @author Lakshmi Krishnamurthy + */ + +public class CollateralGroup +{ + private double[][] _positionGroupArrayVertex = null; + private org.drip.xva.universe.MarketVertex[] _marketVertexArray = null; + private org.drip.xva.set.CollateralGroupSpecification _collateralGroupSpecification = null; + + private org.drip.measure.bridge.BrokenDateInterpolator brokenDateInterpolator ( + final int positionGroupIndex, + final int vertexIndex) + { + int brokenDateScheme = _collateralGroupSpecification.brokenDateScheme(); + + try + { + if (org.drip.xva.settings.BrokenDateScheme.LINEAR_TIME == brokenDateScheme) + { + return 0 == vertexIndex ? null : new org.drip.measure.bridge.BrokenDateInterpolatorLinearT ( + _marketVertexArray[vertexIndex - 1].anchorDate().julian(), + _marketVertexArray[vertexIndex].anchorDate().julian(), + _positionGroupArrayVertex[positionGroupIndex][vertexIndex - 1], + _positionGroupArrayVertex[positionGroupIndex][vertexIndex] + ); + } + + if (org.drip.xva.settings.BrokenDateScheme.SQUARE_ROOT_OF_TIME == brokenDateScheme) + { + return 0 == vertexIndex ? null : new org.drip.measure.bridge.BrokenDateInterpolatorSqrtT ( + _marketVertexArray[vertexIndex - 1].anchorDate().julian(), + _marketVertexArray[vertexIndex].anchorDate().julian(), + _positionGroupArrayVertex[positionGroupIndex][vertexIndex - 1], + _positionGroupArrayVertex[positionGroupIndex][vertexIndex] + ); + } + + if (org.drip.xva.settings.BrokenDateScheme.THREE_POINT_BROWNIAN_BRIDGE == brokenDateScheme) + { + return 0 == vertexIndex || 1 == vertexIndex ? null : new + org.drip.measure.bridge.BrokenDateInterpolatorBrownian3P ( + _marketVertexArray[vertexIndex - 2].anchorDate().julian(), + _marketVertexArray[vertexIndex - 1].anchorDate().julian(), + _marketVertexArray[vertexIndex].anchorDate().julian(), + _positionGroupArrayVertex[positionGroupIndex][vertexIndex - 2], + _positionGroupArrayVertex[positionGroupIndex][vertexIndex - 1], + _positionGroupArrayVertex[positionGroupIndex][vertexIndex] + ); + } + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + } + + return null; + } + + private double collateralBalance ( + final int positionGroupIndex, + final int vertexIndex) + throws java.lang.Exception + { + org.drip.measure.bridge.BrokenDateInterpolator brokenDateInterpolator = brokenDateInterpolator ( + positionGroupIndex, + vertexIndex + ); + + return null == brokenDateInterpolator ? 0. : new org.drip.xva.hypothecation.CollateralAmountEstimator ( + _collateralGroupSpecification, + brokenDateInterpolator, + java.lang.Double.NaN + ).postingRequirement (_marketVertexArray[vertexIndex].anchorDate()); + } + + private double[][] positionGroupCollateralBalanceArray() + { + int vertexCount = _marketVertexArray.length; + int positionGroupCount = _positionGroupArrayVertex.length; + double[][] collateralBalanceArray = new double[positionGroupCount][vertexCount]; + + for (int positionGroupIndex = 0; positionGroupIndex < positionGroupCount; ++positionGroupIndex) + { + for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) + { + try + { + collateralBalanceArray[positionGroupIndex][vertexIndex] = collateralBalance ( + positionGroupIndex, + vertexIndex + ); + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + + return null; + } + } + } + + return collateralBalanceArray; + } + + private org.drip.xva.hypothecation.CollateralGroupVertex collateralGroupVertex ( + final org.drip.analytics.date.JulianDate anchorDate, + final double positionGroupValue, + final double realizedCashFlow, + final double collateralBalance, + final org.drip.xva.universe.MarketEdge marketEdge) + { + int closeOutScheme = _collateralGroupSpecification.closeOutScheme(); + + int positionReplicationScheme = _collateralGroupSpecification.positionReplicationScheme(); + + org.drip.xva.definition.CloseOut closeOut = + org.drip.xva.settings.CloseOutScheme.BILATERAL == closeOutScheme || null == marketEdge ? null : + org.drip.xva.definition.CloseOutBilateral.Market (marketEdge.finish()); + + try + { + if (org.drip.xva.settings.PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX == + positionReplicationScheme) + { + return new org.drip.xva.hypothecation.AlbaneseAndersenVertex ( + anchorDate, + positionGroupValue, + realizedCashFlow, + collateralBalance + ); + } + + if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_HEDGE_ERROR_DUAL_BOND_VERTEX == + positionReplicationScheme) + { + return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.HedgeErrorDualBond ( + anchorDate, + positionGroupValue, + realizedCashFlow, + collateralBalance, + _collateralGroupSpecification.hedgeError(), + marketEdge, + closeOut + ); + } + + if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_SEMI_REPLICATION_DUAL_BOND_VERTEX + == positionReplicationScheme) + { + return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.SemiReplicationDualBond ( + anchorDate, + positionGroupValue, + realizedCashFlow, + collateralBalance, + marketEdge, + closeOut + ); + } + + if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_GOLD_PLATED_TWO_WAY_CSA_VERTEX + == positionReplicationScheme) + { + return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.GoldPlatedTwoWayCSA ( + anchorDate, + positionGroupValue, + realizedCashFlow, + marketEdge, + closeOut + ); + } + + if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_ONE_WAY_CSA_VERTEX == + positionReplicationScheme) + { + return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.OneWayCSA ( + anchorDate, + positionGroupValue, + realizedCashFlow, + marketEdge, + closeOut + ); + } + + if (org.drip.xva.settings.PositionReplicationScheme.BURGARD_KJAER_SET_OFF_VERTEX == + positionReplicationScheme) + { + return org.drip.xva.hypothecation.BurgardKjaerVertexBuilder.SetOff ( + anchorDate, + positionGroupValue, + realizedCashFlow, + collateralBalance, + marketEdge + ); + } + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * CollateralGroup Constructor + * + * @param collateralGroupSpecification The Collateral Group Specification + * @param marketVertexArray Array of Market Vertexes + * @param positionGroupArrayVertex Vertexes of the Position Group Array + * + * @throws java.lang.Exception Thrown if the Inputs are Invalid + */ + + public CollateralGroup ( + final org.drip.xva.set.CollateralGroupSpecification collateralGroupSpecification, + final org.drip.xva.universe.MarketVertex[] marketVertexArray, + final double[][] positionGroupArrayVertex) + throws java.lang.Exception + { + if (null == (_collateralGroupSpecification = collateralGroupSpecification) || + null == (_marketVertexArray = marketVertexArray) || + null == (_positionGroupArrayVertex = positionGroupArrayVertex)) + { + throw new java.lang.Exception ("CollateralGroup Constructor => Invalid Inputs"); + } + + int vertexCount = _marketVertexArray.length; + int positionGroupCount = _positionGroupArrayVertex.length; + + if (0 == vertexCount || + 0 == positionGroupCount) + { + throw new java.lang.Exception ("CollateralGroup Constructor => Invalid Inputs"); + } + + for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) + { + if (null == _marketVertexArray[vertexIndex]) + { + throw new java.lang.Exception ("CollateralGroup Constructor => Invalid Inputs"); + } + } + + for (int positionGroupIndex = 0; positionGroupIndex < positionGroupCount; ++positionGroupIndex) + { + if (null == _positionGroupArrayVertex[positionGroupIndex] || + vertexCount != _positionGroupArrayVertex[positionGroupIndex].length || + !org.drip.quant.common.NumberUtil.IsValid (_positionGroupArrayVertex[positionGroupIndex])) + { + throw new java.lang.Exception ("CollateralGroup Constructor => Invalid Inputs"); + } + } + } + + /** + * Retrieve the Collateral Group Specification + * + * @return The Collateral Group Specification + */ + + public org.drip.xva.set.CollateralGroupSpecification collateralGroupSpecification() + { + return _collateralGroupSpecification; + } + + /** + * Retrieve the Market Vertex Array + * + * @return The Market Vertex Array + */ + + public org.drip.xva.universe.MarketVertex[] marketVertexArray() + { + return _marketVertexArray; + } + + /** + * Retrieve the Position Group Array Vertex Value + * + * @return The Position Group Array Vertex Value + */ + + public double[][] positionGroupArrayVertex() + { + return _positionGroupArrayVertex; + } + + /** + * Generate the Position Collateral Group Vertex Array + * + * @return The Position Collateral Group Vertex Array + */ + + public org.drip.xva.hypothecation.CollateralGroupVertex[][] positionGroupVertexArray() + { + double[][] collateralBalanceArray = positionGroupCollateralBalanceArray(); + + if (null == collateralBalanceArray) + { + return null; + } + + int vertexCount = _marketVertexArray.length; + int positionGroupCount = _positionGroupArrayVertex.length; + org.drip.xva.hypothecation.CollateralGroupVertex[][] collateralGroupVertexArray = new + org.drip.xva.hypothecation.CollateralGroupVertex[positionGroupCount][vertexCount]; + + for (int positionGroupIndex = 0; positionGroupIndex < positionGroupCount; ++positionGroupIndex) + { + for (int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) + { + try + { + collateralGroupVertexArray[positionGroupIndex][vertexIndex] = collateralGroupVertex ( + _marketVertexArray[vertexIndex].anchorDate(), + _positionGroupArrayVertex[positionGroupIndex][vertexIndex], + 0., + collateralBalanceArray[positionGroupIndex][vertexIndex], + 0 == vertexIndex ? null : new org.drip.xva.universe.MarketEdge ( + _marketVertexArray[vertexIndex - 1], + _marketVertexArray[vertexIndex] + ) + ); + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + + return null; + } + } + } + + return collateralGroupVertexArray; + } +} diff --git a/src/main/java/org/drip/xva/set/CollateralGroupSpecification.java b/src/main/java/org/drip/xva/set/CollateralGroupSpecification.java index 0b5831ab33af..580d65110b7c 100644 --- a/src/main/java/org/drip/xva/set/CollateralGroupSpecification.java +++ b/src/main/java/org/drip/xva/set/CollateralGroupSpecification.java @@ -69,6 +69,7 @@ public class CollateralGroupSpecification extends org.drip.xva.set.RollUpGroupSpecification { + private int _closeOutScheme = -1; private int _brokenDateScheme = -1; private int _bankDefaultWindow = -1; private int _counterPartyDefaultWindow = -1; @@ -76,7 +77,6 @@ public class CollateralGroupSpecification extends org.drip.xva.set.RollUpGroupSp private double _hedgeError = java.lang.Double.NaN; private double _independentAmount = java.lang.Double.NaN; private double _minimumTransferAmount = java.lang.Double.NaN; - private org.drip.xva.definition.CloseOut _closeOutScheme = null; private org.drip.function.definition.R1ToR1 _bankThresholdFunction = null; private org.drip.function.definition.R1ToR1[] _counterPartyThresholdFunctionArray = null; @@ -97,7 +97,7 @@ public static final CollateralGroupSpecification ZeroThreshold ( final int positionReplicationScheme, final int brokenDateScheme, final double hedgeError, - final org.drip.xva.definition.CloseOut closeOutScheme) + final int closeOutScheme) { try { @@ -145,7 +145,7 @@ public static final CollateralGroupSpecification FixedThreshold ( final int positionReplicationScheme, final int brokenDateScheme, final double hedgeError, - final org.drip.xva.definition.CloseOut closeOutScheme) + final int closeOutScheme) { if (!org.drip.quant.common.NumberUtil.IsValid (counterPartyThreshold) || 0. > counterPartyThreshold || !org.drip.quant.common.NumberUtil.IsValid (bankThreshold) || 0. < bankThreshold) @@ -213,7 +213,7 @@ public CollateralGroupSpecification ( final int positionReplicationScheme, final int brokenDateScheme, final double hedgeError, - final org.drip.xva.definition.CloseOut closeOutScheme) + final int closeOutScheme) throws java.lang.Exception { super ( @@ -342,7 +342,7 @@ public double hedgeError() * @return The Close Out Scheme */ - public org.drip.xva.definition.CloseOut closeOutScheme() + public int closeOutScheme() { return _closeOutScheme; } diff --git a/src/main/java/org/drip/xva/settings/CloseOutScheme.java b/src/main/java/org/drip/xva/settings/CloseOutScheme.java new file mode 100644 index 000000000000..b47445185843 --- /dev/null +++ b/src/main/java/org/drip/xva/settings/CloseOutScheme.java @@ -0,0 +1,83 @@ + +package org.drip.xva.settings; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2018 Lakshmi Krishnamurthy + * + * This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model + * libraries targeting analysts and developers + * https://lakshmidrip.github.io/DRIP/ + * + * DRIP is composed of four main libraries: + * + * - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ + * - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ + * - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ + * - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ + * + * - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, + * Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA + * Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV + * Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM + * Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. + * + * - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy + * Incorporator, Holdings Constraint, and Transaction Costs. + * + * - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. + * + * - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * CloseOutScheme carries the Close Out Specification Schemes for the Simulation. The References are: + * + * - Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party Risk + * and Funding Costs, Journal of Credit Risk, 7 (3) 1-19. + * + * - Burgard, C., and M. Kjaer (2014): In the Balance, Risk, 24 (11) 72-75. + * + * - Albanese, C., and L. Andersen (2014): Accounting for OTC Derivatives: Funding Adjustments and the + * Re-Hypothecation Option, eSSRN, https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2482955. + * + * - Albanese, C., L. Andersen, and, S. Iabichino (2015): The FVA Puzzle: Accounting, Risk Management, and + * Collateral Trading https://papers.ssrn.com/sol3/paper.cfm?abstract_id_2517301

+ * + * - Burgard, C., and M. Kjaer (2017): Derivatives Funding, Netting, and Accounting, eSSRN, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2534011. + * + * @author Lakshmi Krishnamurthy + */ + +public class CloseOutScheme +{ + + /** + * The Bank/Counter Party ISDA 92 Close Out Scheme + */ + + public static final int ISDA_92 = 0; + + /** + * The Bank/Counter Party Bilateral Close Out Scheme + */ + + public static final int BILATERAL = 1; +} diff --git a/src/main/java/org/drip/xva/settings/PathSimulatorScheme.java b/src/main/java/org/drip/xva/settings/PathSimulatorScheme.java deleted file mode 100644 index 714370771739..000000000000 --- a/src/main/java/org/drip/xva/settings/PathSimulatorScheme.java +++ /dev/null @@ -1,189 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2018 Lakshmi Krishnamurthy - * - * This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model - * libraries targeting analysts and developers - * https://lakshmidrip.github.io/DRIP/ - * - * DRIP is composed of four main libraries: - * - * - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ - * - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ - * - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ - * - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ - * - * - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, - * Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA - * Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV - * Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM - * Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. - * - * - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy - * Incorporator, Holdings Constraint, and Transaction Costs. - * - * - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. - * - * - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * PathSimulatorScheme specifies the Hypothecation Vertex Generation Schemes for the Simulation. The - * References are: - * - * - Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party Risk - * and Funding Costs, Journal of Credit Risk, 7 (3) 1-19. - * - * - Burgard, C., and M. Kjaer (2014): In the Balance, Risk, 24 (11) 72-75. - * - * - Albanese, C., and L. Andersen (2014): Accounting for OTC Derivatives: Funding Adjustments and the - * Re-Hypothecation Option, eSSRN, https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2482955. - * - * - Burgard, C., and M. Kjaer (2017): Derivatives Funding, Netting, and Accounting, eSSRN, - * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2534011. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PathSimulatorScheme -{ - private int _brokenDateScheme = -1; - private int _adjustmentDigestScheme = -1; - private int _positionReplicationScheme = -1; - private double _hedgeError = java.lang.Double.NaN; - private org.drip.xva.definition.CloseOut _closeOutScheme = null; - - /** - * Construct an Albanese Andersen Vertex Generator Based Path Simulator Scheme - * - * @return The Albanese Andersen Vertex Generator Based Path Simulator Scheme - */ - - public static PathSimulatorScheme AlbaneseAndersenVertex() - { - try - { - return new PathSimulatorScheme ( - org.drip.xva.settings.PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX, - org.drip.xva.settings.BrokenDateScheme.SQUARE_ROOT_OF_TIME, - org.drip.xva.settings.AdjustmentDigestScheme.ALBANESE_ANDERSEN_METRICS_POINTER, - 0., - null - ); - } - catch (java.lang.Exception e) - { - e.printStackTrace(); - } - - return null; - } - - /** - * PathSimulatorScheme Constructor - * - * @param positionReplicationScheme Position Replication Scheme - * @param brokenDateScheme Broken Date Interpolation Scheme - * @param adjustmentDigestScheme Adjustment Digest Scheme - * @param hedgeError Hedge Error - * @param closeOutScheme Close Out Scheme - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PathSimulatorScheme ( - final int positionReplicationScheme, - final int brokenDateScheme, - final int adjustmentDigestScheme, - final double hedgeError, - final org.drip.xva.definition.CloseOut closeOutScheme) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_hedgeError = hedgeError)) - { - throw new java.lang.Exception ("PathSimulatorScheme Constructor => Invalid Inputs!"); - } - - _closeOutScheme = closeOutScheme; - _brokenDateScheme = brokenDateScheme; - _adjustmentDigestScheme = adjustmentDigestScheme; - _positionReplicationScheme = positionReplicationScheme; - } - - /** - * Retrieve the Position Replication Scheme - * - * @return The Position Replication Scheme - */ - - public int positionReplicationScheme() - { - return _positionReplicationScheme; - } - - /** - * Retrieve the Broken Date Interpolation Scheme - * - * @return The Broken Date Interpolation Scheme - */ - - public int brokenDateScheme() - { - return _brokenDateScheme; - } - - /** - * Retrieve the Adjustment Digest Scheme - * - * @return The Adjustment Digest Scheme - */ - - public int adjustmentDigestScheme() - { - return _adjustmentDigestScheme; - } - - /** - * Retrieve the Hedge Error - * - * @return The Hedge Error - */ - - public double hedgeError() - { - return _hedgeError; - } - - /** - * Retrieve the Close Out Scheme - * - * @return The Close Out Scheme - */ - - public org.drip.xva.definition.CloseOut closeOutScheme() - { - return _closeOutScheme; - } -}