Skip to content

Commit b19956a

Browse files
committed
Features:
- Credit Debt Collateral Value Adjustment (1, 2) - Collateral Group Path Value Adjustment (3, 4) Bug Fixes/Clean-up: Samples:
1 parent d0a24be commit b19956a

File tree

3 files changed

+102
-129
lines changed

3 files changed

+102
-129
lines changed

ReleaseNotes/03_28_2018.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
Features:
3+
4+
- Credit Debt Collateral Value Adjustment (1, 2)
5+
- Collateral Group Path Value Adjustment (3, 4)
6+
7+
8+
Bug Fixes/Clean-up:
9+
10+
Samples:

src/main/java/org/drip/xva/netting/CollateralGroupPath.java

Lines changed: 38 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ public org.drip.analytics.date.JulianDate[] anchorDates()
143143
}
144144

145145
/**
146-
* Retrieve the Array of Collateralized Exposures
146+
* Retrieve the Array of Vertex Collateralized Exposures
147147
*
148-
* @return The Array of Collateralized Exposures
148+
* @return The Array of Vertex Collateralized Exposures
149149
*/
150150

151151
public double[] collateralizedExposure()
@@ -175,9 +175,9 @@ public double[] collateralizedExposure()
175175
}
176176

177177
/**
178-
* Retrieve the Array of Collateralized Exposure PV
178+
* Retrieve the Array of Vertex Collateralized Exposure PV
179179
*
180-
* @return The Array of Collateralized Exposure PV
180+
* @return The Array of Vertex Collateralized Exposure PV
181181
*/
182182

183183
public double[] collateralizedExposurePV()
@@ -210,9 +210,9 @@ public double[] collateralizedExposurePV()
210210
}
211211

212212
/**
213-
* Retrieve the Array of Collateralized Positive Exposures
213+
* Retrieve the Array of Vertex Collateralized Positive Exposures
214214
*
215-
* @return The Array of Collateralized Positive Exposures
215+
* @return The Array of Vertex Collateralized Positive Exposures
216216
*/
217217

218218
public double[] collateralizedPositiveExposure()
@@ -247,9 +247,9 @@ public double[] collateralizedPositiveExposure()
247247
}
248248

249249
/**
250-
* Retrieve the Array of Collateralized Positive Exposure PV
250+
* Retrieve the Array of Vertex Collateralized Positive Exposure PV
251251
*
252-
* @return The Array of Collateralized Positive Exposures PV
252+
* @return The Array of Vertex Collateralized Positive Exposures PV
253253
*/
254254

255255
public double[] collateralizedPositiveExposurePV()
@@ -287,9 +287,9 @@ public double[] collateralizedPositiveExposurePV()
287287
}
288288

289289
/**
290-
* Retrieve the Array of Collateralized Negative Exposures
290+
* Retrieve the Array of Vertex Collateralized Negative Exposures
291291
*
292-
* @return The Array of Collateralized Negative Exposures
292+
* @return The Array of Vertex Collateralized Negative Exposures
293293
*/
294294

295295
public double[] collateralizedNegativeExposure()
@@ -324,9 +324,9 @@ public double[] collateralizedNegativeExposure()
324324
}
325325

326326
/**
327-
* Retrieve the Array of Collateralized Negative Exposure PV
327+
* Retrieve the Array of Vertex Collateralized Negative Exposure PV
328328
*
329-
* @return The Array of Collateralized Negative Exposure PV
329+
* @return The Array of Vertex Collateralized Negative Exposure PV
330330
*/
331331

332332
public double[] collateralizedNegativeExposurePV()
@@ -364,9 +364,9 @@ public double[] collateralizedNegativeExposurePV()
364364
}
365365

366366
/**
367-
* Retrieve the Array of Uncollateralized Exposures
367+
* Retrieve the Array of Vertex Uncollateralized Exposures
368368
*
369-
* @return The Array of Uncollateralized Exposures
369+
* @return The Array of Vertex Uncollateralized Exposures
370370
*/
371371

372372
public double[] uncollateralizedExposure()
@@ -396,9 +396,9 @@ public double[] uncollateralizedExposure()
396396
}
397397

398398
/**
399-
* Retrieve the Array of Uncollateralized Exposure PV
399+
* Retrieve the Array of Vertex Uncollateralized Exposure PV
400400
*
401-
* @return The Array of Uncollateralized Exposure PV
401+
* @return The Array of Vertex Uncollateralized Exposure PV
402402
*/
403403

404404
public double[] uncollateralizedExposurePV()
@@ -431,9 +431,9 @@ public double[] uncollateralizedExposurePV()
431431
}
432432

433433
/**
434-
* Retrieve the Array of Uncollateralized Positive Exposures
434+
* Retrieve the Array of Vertex Uncollateralized Positive Exposures
435435
*
436-
* @return The Array of Uncollateralized Positive Exposures
436+
* @return The Array of Vertex Uncollateralized Positive Exposures
437437
*/
438438

439439
public double[] uncollateralizedPositiveExposure()
@@ -467,9 +467,9 @@ public double[] uncollateralizedPositiveExposure()
467467
}
468468

469469
/**
470-
* Retrieve the Array of Uncollateralized Positive Exposure PV
470+
* Retrieve the Array of Vertex Uncollateralized Positive Exposure PV
471471
*
472-
* @return The Array of Uncollateralized Positive Exposure PV
472+
* @return The Array of Vertex Uncollateralized Positive Exposure PV
473473
*/
474474

475475
public double[] uncollateralizedPositiveExposurePV()
@@ -507,9 +507,9 @@ public double[] uncollateralizedPositiveExposurePV()
507507
}
508508

509509
/**
510-
* Retrieve the Array of Uncollateralized Negative Exposures
510+
* Retrieve the Array of Vertex Uncollateralized Negative Exposures
511511
*
512-
* @return The Array of Uncollateralized Negative Exposures
512+
* @return The Array of Vertex Uncollateralized Negative Exposures
513513
*/
514514

515515
public double[] uncollateralizedNegativeExposure()
@@ -544,9 +544,9 @@ public double[] uncollateralizedNegativeExposure()
544544
}
545545

546546
/**
547-
* Retrieve the Array of Uncollateralized Negative Exposure PV
547+
* Retrieve the Array of Vertex Uncollateralized Negative Exposure PV
548548
*
549-
* @return The Array of Uncollateralized Negative Exposure PV
549+
* @return The Array of Vertex Uncollateralized Negative Exposure PV
550550
*/
551551

552552
public double[] uncollateralizedNegativeExposurePV()
@@ -584,9 +584,9 @@ public double[] uncollateralizedNegativeExposurePV()
584584
}
585585

586586
/**
587-
* Retrieve the Array of Collateral Balances
587+
* Retrieve the Array of Vertex Collateral Balances
588588
*
589-
* @return The Array of Collateral Balances
589+
* @return The Array of Vertex Collateral Balances
590590
*/
591591

592592
public double[] collateralBalance()
@@ -616,9 +616,9 @@ public double[] collateralBalance()
616616
}
617617

618618
/**
619-
* Retrieve the Array of Credit Exposures
619+
* Retrieve the Array of Vertex Credit Exposures
620620
*
621-
* @return The Array of Credit Exposures
621+
* @return The Array of Vertex Credit Exposures
622622
*/
623623

624624
public double[] creditExposure()
@@ -648,9 +648,9 @@ public double[] creditExposure()
648648
}
649649

650650
/**
651-
* Retrieve the Array of Credit Exposure PV
651+
* Retrieve the Array of Vertex Credit Exposure PV
652652
*
653-
* @return The Array of Credit Exposure PV
653+
* @return The Array of Vertex Credit Exposure PV
654654
*/
655655

656656
public double[] creditExposurePV()
@@ -683,9 +683,9 @@ public double[] creditExposurePV()
683683
}
684684

685685
/**
686-
* Retrieve the Array of Debt Exposures
686+
* Retrieve the Array of Vertex Debt Exposures
687687
*
688-
* @return The Array of Debt Exposures
688+
* @return The Array of Vertex Debt Exposures
689689
*/
690690

691691
public double[] debtExposure()
@@ -714,9 +714,9 @@ public double[] debtExposure()
714714
}
715715

716716
/**
717-
* Retrieve the Array of Debt Exposure PV
717+
* Retrieve the Array of Vertex Debt Exposure PV
718718
*
719-
* @return The Array of Debt Exposure PV
719+
* @return The Array of Vertex Debt Exposure PV
720720
*/
721721

722722
public double[] debtExposurePV()
@@ -748,9 +748,9 @@ public double[] debtExposurePV()
748748
}
749749

750750
/**
751-
* Retrieve the Array of Funding Exposures
751+
* Retrieve the Array of Vertex Funding Exposures
752752
*
753-
* @return The Array of Funding Exposures
753+
* @return The Array of Vertex Funding Exposures
754754
*/
755755

756756
public double[] fundingExposure()
@@ -780,9 +780,9 @@ public double[] fundingExposure()
780780
}
781781

782782
/**
783-
* Retrieve the Array of Funding Exposure PV
783+
* Retrieve the Array of Vertex Funding Exposure PV
784784
*
785-
* @return The Array of Funding Exposure PV
785+
* @return The Array of Vertex Funding Exposure PV
786786
*/
787787

788788
public double[] fundingExposurePV()
@@ -814,43 +814,6 @@ public double[] fundingExposurePV()
814814
return fundingExposurePV;
815815
}
816816

817-
/**
818-
* Compute Period-wise Path Bilateral Collateral Value Adjustment
819-
*
820-
* @return The Period-wise Path Bilateral Collateral Value Adjustment
821-
*/
822-
823-
public double[] periodBilateralCollateralValueAdjustment()
824-
{
825-
org.drip.xva.universe.MarketVertex[] marketVertexArray = _marketPath.vertexes();
826-
827-
double[] collateralBalance = collateralBalance();
828-
829-
int vertexCount = collateralBalance.length;
830-
double[] periodBilateralCollateralValueAdjustment = new double[vertexCount - 1];
831-
832-
for (int vertexIndex = 1; vertexIndex < vertexCount; ++vertexIndex)
833-
{
834-
double periodIntegrandStart = collateralBalance[vertexIndex - 1] *
835-
marketVertexArray[vertexIndex - 1].dealer().survivalProbability() *
836-
marketVertexArray[vertexIndex - 1].client().survivalProbability() *
837-
marketVertexArray[vertexIndex - 1].csaSpread() *
838-
marketVertexArray[vertexIndex - 1].overnightReplicator();
839-
840-
double periodIntegrandEnd = collateralBalance[vertexIndex] *
841-
marketVertexArray[vertexIndex].dealer().survivalProbability() *
842-
marketVertexArray[vertexIndex].client().survivalProbability() *
843-
marketVertexArray[vertexIndex].csaSpread() *
844-
marketVertexArray[vertexIndex].overnightReplicator();
845-
846-
periodBilateralCollateralValueAdjustment[vertexIndex - 1] = -0.5 * (periodIntegrandStart +
847-
periodIntegrandEnd) * (marketVertexArray[vertexIndex].anchorDate().julian() -
848-
marketVertexArray[vertexIndex - 1].anchorDate().julian()) / 365.25;
849-
}
850-
851-
return periodBilateralCollateralValueAdjustment;
852-
}
853-
854817
/**
855818
* Compute Period-wise Path Collateral Value Adjustment
856819
*
@@ -885,58 +848,4 @@ public double[] periodCollateralValueAdjustment()
885848

886849
return periodCollateralValueAdjustment;
887850
}
888-
889-
/**
890-
* Compute Path Bilateral Collateral Value Adjustment
891-
*
892-
* @return The Path Bilateral Collateral Value Adjustment
893-
*
894-
* @throws java.lang.Exception Thrown if the Inputs are Invalid
895-
*/
896-
897-
public double bilateralCollateralAdjustment()
898-
throws java.lang.Exception
899-
{
900-
org.drip.xva.universe.MarketVertex[] marketVertexArray = _marketPath.vertexes();
901-
902-
double[] collateralBalance = collateralBalance();
903-
904-
double bilateralCollateralValueAdjustment = 0.;
905-
int vertexCount = collateralBalance.length;
906-
907-
for (int vertexIndex = 1; vertexIndex < vertexCount; ++vertexIndex)
908-
{
909-
double periodIntegrandStart = collateralBalance[vertexIndex - 1] *
910-
marketVertexArray[vertexIndex - 1].dealer().survivalProbability() *
911-
marketVertexArray[vertexIndex - 1].client().survivalProbability() *
912-
marketVertexArray[vertexIndex - 1].csaSpread() *
913-
marketVertexArray[vertexIndex - 1].overnightReplicator();
914-
915-
double periodIntegrandEnd = collateralBalance[vertexIndex] *
916-
marketVertexArray[vertexIndex].dealer().survivalProbability() *
917-
marketVertexArray[vertexIndex].client().survivalProbability() *
918-
marketVertexArray[vertexIndex].csaSpread() *
919-
marketVertexArray[vertexIndex].overnightReplicator();
920-
921-
bilateralCollateralValueAdjustment -= 0.5 * (periodIntegrandStart + periodIntegrandEnd) *
922-
(marketVertexArray[vertexIndex].anchorDate().julian() -
923-
marketVertexArray[vertexIndex - 1].anchorDate().julian()) / 365.25;
924-
}
925-
926-
return bilateralCollateralValueAdjustment;
927-
}
928-
929-
/**
930-
* Compute Path Collateral Value Adjustment
931-
*
932-
* @return The Path Collateral Value Adjustment
933-
*
934-
* @throws java.lang.Exception Thrown if the Inputs are Invalid
935-
*/
936-
937-
public double collateralAdjustment()
938-
throws java.lang.Exception
939-
{
940-
return bilateralCollateralAdjustment();
941-
}
942851
}

0 commit comments

Comments
 (0)