From 664d31e17bad6dd90b7c43383f88d8baf5ced0bc Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Sat, 16 Jun 2018 17:30:04 -0400 Subject: [PATCH] Features: - Margin Plus Trade Payment Regression (1) - Trade Regression Path Coordinator Shell (2) - Variation Margin Trade Payment Generator (3) - Vertex Generating Coordinate Market Path (4) - Trade Regression Path Coordinator Constructor (5, 6, 7) - Sparse Variation Margin Estimate #1 (8, 9) - Sparse Variation Margin Estimate #2 (10, 11, 12) - Dense Exposure Date Trade Payment (13, 14) - Adjusted Variation Margin Vertex Shell (15) - Adjusted Variation Margin Vertex Before (16) - Adjusted Variation Margin Vertex After (17, 18) - Variation Margin Vertex Constructor Annotation (19, 20, 21) - Andersen Pykhtin Sokol Path Shell (22) - Andersen Pykhtin Sokol Path Trade (23) - Path Variation Margin Exposure Trajectory (24) - Andersen Pykhtin Sokol Path Constructor (26, 27, 28) - Andersen Pykhtin Sokol Path #1 (29, 30) - Andersen Pykhtin Sokol Path #2 (31, 32) - Andersen Pykhtin Sokol Path #3 (33, 34) - Andersen Pykhtin Sokol Path #4 (35, 36) - Andersen Pykhtin Sokol Path #5 (37, 38) - Andersen Pykhtin Sokol Path #6 (39, 40) Bug Fixes/Clean-up: - Variation Margin Estimate Vertex Switch (25) - Andersen Pykhtin Sokol 2017 VM (41) - Period Cumulative Trade Payment Fix (43, 44, 45) - Variation Margin Vertex Estimate Addition (52) Samples: - Path Trade Flow Adjustment Shell (42) - Path Trade Flow Adjustment #1 (46, 47) - Path Trade Flow Adjustment #2 (48, 49) - Path Trade Flow Adjustment #3 (50, 51) - Path Trade Flow Adjustment #4 (53, 54) - Path Trade Flow Adjustment #5 (55, 56) - Path Trade Flow Adjustment #6 (57, 58) - Path Trade Flow Adjustment #7 (59, 60) --- ReleaseNotes/06_11_2018.txt | 45 ++ .../AndersenPykhtinSokolPath.java | 156 ++++ .../regressiontrade/PathCoordinator.java | 258 +++++++ .../VariationMarginEstimateVertex.java | 119 +++ .../regressiontrade/package-info.java | 8 + .../PathTradeFlowAdjustment.java | 717 ++++++++++++++++++ .../sample/andersen2017vm/package-info.java | 8 + .../org/drip/service/env/BuildManager.java | 5 + 8 files changed, 1316 insertions(+) create mode 100644 ReleaseNotes/06_11_2018.txt create mode 100644 src/main/java/org/drip/exposure/regressiontrade/AndersenPykhtinSokolPath.java create mode 100644 src/main/java/org/drip/exposure/regressiontrade/PathCoordinator.java create mode 100644 src/main/java/org/drip/exposure/regressiontrade/VariationMarginEstimateVertex.java create mode 100644 src/main/java/org/drip/exposure/regressiontrade/package-info.java create mode 100644 src/main/java/org/drip/sample/andersen2017vm/PathTradeFlowAdjustment.java create mode 100644 src/main/java/org/drip/sample/andersen2017vm/package-info.java diff --git a/ReleaseNotes/06_11_2018.txt b/ReleaseNotes/06_11_2018.txt new file mode 100644 index 000000000000..d2d49ccab390 --- /dev/null +++ b/ReleaseNotes/06_11_2018.txt @@ -0,0 +1,45 @@ + +Features: + + - Margin Plus Trade Payment Regression (1) + - Trade Regression Path Coordinator Shell (2) + - Variation Margin Trade Payment Generator (3) + - Vertex Generating Coordinate Market Path (4) + - Trade Regression Path Coordinator Constructor (5, 6, 7) + - Sparse Variation Margin Estimate #1 (8, 9) + - Sparse Variation Margin Estimate #2 (10, 11, 12) + - Dense Exposure Date Trade Payment (13, 14) + - Adjusted Variation Margin Vertex Shell (15) + - Adjusted Variation Margin Vertex Before (16) + - Adjusted Variation Margin Vertex After (17, 18) + - Variation Margin Vertex Constructor Annotation (19, 20, 21) + - Andersen Pykhtin Sokol Path Shell (22) + - Andersen Pykhtin Sokol Path Trade (23) + - Path Variation Margin Exposure Trajectory (24) + - Andersen Pykhtin Sokol Path Constructor (26, 27, 28) + - Andersen Pykhtin Sokol Path #1 (29, 30) + - Andersen Pykhtin Sokol Path #2 (31, 32) + - Andersen Pykhtin Sokol Path #3 (33, 34) + - Andersen Pykhtin Sokol Path #4 (35, 36) + - Andersen Pykhtin Sokol Path #5 (37, 38) + - Andersen Pykhtin Sokol Path #6 (39, 40) + + +Bug Fixes/Clean-up: + + - Variation Margin Estimate Vertex Switch (25) + - Andersen Pykhtin Sokol 2017 VM (41) + - Period Cumulative Trade Payment Fix (43, 44, 45) + - Variation Margin Vertex Estimate Addition (52) + + +Samples: + + - Path Trade Flow Adjustment Shell (42) + - Path Trade Flow Adjustment #1 (46, 47) + - Path Trade Flow Adjustment #2 (48, 49) + - Path Trade Flow Adjustment #3 (50, 51) + - Path Trade Flow Adjustment #4 (53, 54) + - Path Trade Flow Adjustment #5 (55, 56) + - Path Trade Flow Adjustment #6 (57, 58) + - Path Trade Flow Adjustment #7 (59, 60) diff --git a/src/main/java/org/drip/exposure/regressiontrade/AndersenPykhtinSokolPath.java b/src/main/java/org/drip/exposure/regressiontrade/AndersenPykhtinSokolPath.java new file mode 100644 index 000000000000..2c16ee083e4a --- /dev/null +++ b/src/main/java/org/drip/exposure/regressiontrade/AndersenPykhtinSokolPath.java @@ -0,0 +1,156 @@ + +package org.drip.exposure.regressiontrade; + +/* + * -*- 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. + */ + +/** + * AndersenPykhtinSokolPath holds the holds the Sparse Path Adjusted/Unadjusted Exposures along with Dense + * Trade Payments. Adjustments are applied in accordance with the ANdersen, Pykhtin, and Sokol (2017a) + * Regression Scheme. The References are: + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Re-thinking Margin Period of Risk, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2902737, eSSRN. + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN. + * + * - 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. + * + * - Pykhtin, M. (2009): Modeling Counter-party Credit Exposure in the Presence of Margin Agreements, + * http://www.risk-europe.com/protected/michael-pykhtin.pdf. + * + * @author Lakshmi Krishnamurthy + */ + +public class AndersenPykhtinSokolPath +{ + private org.drip.exposure.mpor.TradePayment[] _denseTradePaymentArray = null; + + private java.util.Map + _variationMarginEstimateTrajectory = new java.util.TreeMap(); + + /** + * AndersenPykhtinSokolPath Constructor + * + * @param denseTradePaymentArray The Dense Trade Payment Array + * + * @throws java.lang.Exception Thrown if the Inputs are Invalid + */ + + public AndersenPykhtinSokolPath ( + final org.drip.exposure.mpor.TradePayment[] denseTradePaymentArray) + throws java.lang.Exception + { + if (null == (_denseTradePaymentArray = denseTradePaymentArray) || + 0 == _denseTradePaymentArray.length) + { + throw new java.lang.Exception ("AndersenPykhtinSokolPath Constructor => Invalid Inputs"); + } + } + + /** + * Add the Variation Margin Estimate corresponding to the Vertex + * + * @param vertexDate The Vertex Date + * @param unadjustedVariationMarginEstimate The Unadjusted Variation Margin Estimate + * @param adjustedVariationMarginEstimate The Adjusted Variation Margin Estimate + * + * @return TRUE - The Variation Margin Estimate successfully added to the Vertex + */ + + public boolean addVariationMarginEstimateVertex ( + final int vertexDate, + final double unadjustedVariationMarginEstimate, + final double adjustedVariationMarginEstimate) + { + try + { + _variationMarginEstimateTrajectory.put ( + vertexDate, + new org.drip.exposure.regressiontrade.VariationMarginEstimateVertex ( + unadjustedVariationMarginEstimate, + adjustedVariationMarginEstimate + ) + ); + + return true; + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + } + + return false; + } + + /** + * Retrieve the Path-wise Variation Margin Estimate Trajectory + * + * @return The Path-wise Variation Margin Estimate Trajectory + */ + + public java.util.Map + variationMarginEstimateTrajectory() + { + return _variationMarginEstimateTrajectory; + } + + /** + * Retrieve the Path-wise Dense Trade Payment Array + * + * @return The Path-wise Dense Trade Payment Array + */ + + public org.drip.exposure.mpor.TradePayment[] denseTradePaymentArray() + { + return _denseTradePaymentArray; + } +} diff --git a/src/main/java/org/drip/exposure/regressiontrade/PathCoordinator.java b/src/main/java/org/drip/exposure/regressiontrade/PathCoordinator.java new file mode 100644 index 000000000000..dc270c5013b9 --- /dev/null +++ b/src/main/java/org/drip/exposure/regressiontrade/PathCoordinator.java @@ -0,0 +1,258 @@ + +package org.drip.exposure.regressiontrade; + +/* + * -*- 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. + */ + +/** + * PathCoordinator coordinates the Generation of the Path-specific Trade Payment Adjusted Variation Margin + * Flows. The References are: + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Re-thinking Margin Period of Risk, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2902737, eSSRN. + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN. + * + * - 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. + * + * - Pykhtin, M. (2009): Modeling Counter-party Credit Exposure in the Presence of Margin Agreements, + * http://www.risk-europe.com/protected/michael-pykhtin.pdf. + * + * @author Lakshmi Krishnamurthy + */ + +public class PathCoordinator +{ + private org.drip.exposure.universe.MarketPath _marketPath = null; + private org.drip.exposure.mpor.VariationMarginTradePaymentVertex _marginTradePaymentGenerator = null; + + private static final double CumulativeTradePayment ( + final org.drip.exposure.mpor.TradePayment[] denseTradePaymentArray, + final int startIndex, + final int endIndex) + { + double cumulativeTradePayment = 0.; + + for (int index = startIndex; index <= endIndex; ++index) + { + cumulativeTradePayment += (denseTradePaymentArray[index].dealer() - + denseTradePaymentArray[index].client()); + } + + return cumulativeTradePayment; + } + + /** + * PathCoordinator Constructor + * + * @param marginTradePaymentGenerator The Path-wise Variation Margin/Trade Payment Generator + * @param marketPath The Market Path + * + * @throws java.lang.Exception Thrown if the Inputs are Invalid + */ + + public PathCoordinator ( + final org.drip.exposure.mpor.VariationMarginTradePaymentVertex marginTradePaymentGenerator, + final org.drip.exposure.universe.MarketPath marketPath) + throws java.lang.Exception + { + if (null == (_marginTradePaymentGenerator = marginTradePaymentGenerator) || + null == (_marketPath = marketPath)) + { + throw new java.lang.Exception ("PathCoordinator Constructor => Invalid Inputs"); + } + } + + /** + * Retrieve the Path-wise Variation Margin/Trade Payment Generator + * + * @return The Path-wise Variation Margin/Trade Payment Generator + */ + + public org.drip.exposure.mpor.VariationMarginTradePaymentVertex marginTradePaymentGenerator() + { + return _marginTradePaymentGenerator; + } + + /** + * Retrieve the Path-wise Market Path + * + * @return The Path-wise Market Path + */ + + public org.drip.exposure.universe.MarketPath marketPath() + { + return _marketPath; + } + + /** + * Generate the Path-wise Variation Margin Estimate on the Exposure Dates + * + * @param exposureDateArray The Path-wise Exposure Dates + * + * @return The Path-wise Variation Margin Estimate on the Exposure Dates + */ + + public double[] variationMarginEstimate ( + final int[] exposureDateArray) + { + if (null == exposureDateArray) + { + return null; + } + + int exposureDateCount = exposureDateArray.length; + double[] variationMarginEstimateArray = 0 == exposureDateCount ? null : new double[exposureDateCount]; + + if (0 == exposureDateCount) + { + return null; + } + + for (int exposureDateIndex = 0; exposureDateIndex < exposureDateCount; ++exposureDateIndex) + { + try + { + variationMarginEstimateArray[exposureDateIndex] = + _marginTradePaymentGenerator.variationMarginEstimate ( + exposureDateArray[exposureDateIndex], + _marketPath + ); + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + + return null; + } + } + + return variationMarginEstimateArray; + } + + /** + * Retrieve the Dense Trade Payment Array across the Exposure Date Range + * + * @param startDate The Exposure Range Start Date + * @param endDate The Exposure Range End Date + * + * @return The Dense Trade Payment Array + */ + + public org.drip.exposure.mpor.TradePayment[] denseTradePayment ( + final int startDate, + final int endDate) + { + return _marginTradePaymentGenerator.denseTradePaymentArray ( + startDate, + endDate, + _marketPath + ); + } + + /** + * Generate the Path-wise Andersen Pykhtin Sokol (2017) Variation Margin Estimates on the Exposure Dates + * + * @param exposureDateArray The Path-wise Exposure Dates + * + * @return The Path-wise Andersen Pykhtin Sokol (2017) Variation Margin Estimates on the Exposure Dates + */ + + public org.drip.exposure.regressiontrade.AndersenPykhtinSokolPath andersenPykhtinSokolPath ( + final int[] exposureDateArray) + { + double[] variationMarginEstimateArray = variationMarginEstimate (exposureDateArray); + + if (null == variationMarginEstimateArray) + { + return null; + } + + int exposureDateCount = variationMarginEstimateArray.length; + org.drip.exposure.regressiontrade.AndersenPykhtinSokolPath andersenPykhtinSokolPath = null; + + org.drip.exposure.mpor.TradePayment[] denseTradePaymentArray = denseTradePayment ( + exposureDateArray[0], + exposureDateArray[exposureDateArray.length - 1] + ); + + try + { + andersenPykhtinSokolPath = new org.drip.exposure.regressiontrade.AndersenPykhtinSokolPath + (denseTradePaymentArray); + } + catch (java.lang.Exception e) + { + e.printStackTrace(); + + return null; + } + + for (int exposureDateIndex = 0; exposureDateIndex < exposureDateCount; ++exposureDateIndex) + { + double periodCumulativeTradePayment = 0 == exposureDateIndex ? 0. : CumulativeTradePayment ( + denseTradePaymentArray, + exposureDateArray[exposureDateIndex - 1] - exposureDateArray[0], + exposureDateArray[exposureDateIndex] - exposureDateArray[0] + ); + + if (!andersenPykhtinSokolPath.addVariationMarginEstimateVertex ( + exposureDateArray[exposureDateIndex], + variationMarginEstimateArray[exposureDateIndex], + variationMarginEstimateArray[exposureDateIndex] - periodCumulativeTradePayment + )) + { + return null; + } + } + + return andersenPykhtinSokolPath; + } +} diff --git a/src/main/java/org/drip/exposure/regressiontrade/VariationMarginEstimateVertex.java b/src/main/java/org/drip/exposure/regressiontrade/VariationMarginEstimateVertex.java new file mode 100644 index 000000000000..4e2e535f080f --- /dev/null +++ b/src/main/java/org/drip/exposure/regressiontrade/VariationMarginEstimateVertex.java @@ -0,0 +1,119 @@ + +package org.drip.exposure.regressiontrade; + +/* + * -*- 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. + */ + +/** + * VariationMarginEstimateVertex holds the Sparse Date Unadjusted and Adjusted Variation Margin Estimates. + * Adjustments are applied in accordance with the Andersen, Pykhtin, and Sokol (2017a) Regression Scheme. + * The References are: + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Re-thinking Margin Period of Risk, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2902737, eSSRN. + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN. + * + * - 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. + * + * - Pykhtin, M. (2009): Modeling Counter-party Credit Exposure in the Presence of Margin Agreements, + * http://www.risk-europe.com/protected/michael-pykhtin.pdf. + * + * @author Lakshmi Krishnamurthy + */ + +public class VariationMarginEstimateVertex +{ + private double _adjusted = java.lang.Double.NaN; + private double _unadjusted = java.lang.Double.NaN; + + /** + * VariationMarginEstimateVertex Constructor + * + * @param unadjusted The Unadjusted Variation Margin at the Vertex + * @param adjusted The Adjusted Variation Margin at the Vertex + * + * @throws java.lang.Exception Thrown if the Inputs are Invalid + */ + + public VariationMarginEstimateVertex ( + final double unadjusted, + final double adjusted) + throws java.lang.Exception + { + if (!org.drip.quant.common.NumberUtil.IsValid (_unadjusted = unadjusted) || + !org.drip.quant.common.NumberUtil.IsValid (_adjusted = adjusted)) + { + throw new java.lang.Exception ("VariationMarginEstimateVertex Constructor => Invalid Inputs"); + } + } + + /** + * Retrieve the Unadjusted Variation Margin at the Vertex + * + * @return The Unadjusted Variation Margin at the Vertex + */ + + public double unadjusted() + { + return _unadjusted; + } + + /** + * Retrieve the Adjusted Variation Margin at the Vertex + * + * @return The Adjusted Variation Margin at the Vertex + */ + + public double adjusted() + { + return _adjusted; + } +} diff --git a/src/main/java/org/drip/exposure/regressiontrade/package-info.java b/src/main/java/org/drip/exposure/regressiontrade/package-info.java new file mode 100644 index 000000000000..ed78e55da312 --- /dev/null +++ b/src/main/java/org/drip/exposure/regressiontrade/package-info.java @@ -0,0 +1,8 @@ + +/** + * Exposure Regression under Margin and Trade Payments + * + * @author Lakshmi Krishnamurthy + */ + +package org.drip.exposure.regressiontrade; diff --git a/src/main/java/org/drip/sample/andersen2017vm/PathTradeFlowAdjustment.java b/src/main/java/org/drip/sample/andersen2017vm/PathTradeFlowAdjustment.java new file mode 100644 index 000000000000..13cc1a9fdf2b --- /dev/null +++ b/src/main/java/org/drip/sample/andersen2017vm/PathTradeFlowAdjustment.java @@ -0,0 +1,717 @@ + +package org.drip.sample.andersen2017vm; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.drip.analytics.date.DateUtil; +import org.drip.analytics.date.JulianDate; +import org.drip.exposure.evolver.EntityDynamicsContainer; +import org.drip.exposure.evolver.LatentStateDynamicsContainer; +import org.drip.exposure.evolver.LatentStateVertexContainer; +import org.drip.exposure.evolver.PrimarySecurity; +import org.drip.exposure.evolver.PrimarySecurityDynamicsContainer; +import org.drip.exposure.evolver.TerminalLatentState; +import org.drip.exposure.generator.FixFloatMPoR; +import org.drip.exposure.mpor.TradePayment; +import org.drip.exposure.regressiontrade.AndersenPykhtinSokolPath; +import org.drip.exposure.regressiontrade.PathCoordinator; +import org.drip.exposure.regressiontrade.VariationMarginEstimateVertex; +import org.drip.exposure.universe.LatentStateWeiner; +import org.drip.exposure.universe.MarketPath; +import org.drip.exposure.universe.MarketVertex; +import org.drip.exposure.universe.MarketVertexGenerator; +import org.drip.market.otc.FixedFloatSwapConvention; +import org.drip.market.otc.IBORFixedFloatContainer; +import org.drip.measure.crng.RandomNumberGenerator; +import org.drip.measure.discrete.CorrelatedPathVertexDimension; +import org.drip.measure.dynamics.DiffusionEvaluatorLinear; +import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; +import org.drip.measure.dynamics.HazardJumpEvaluator; +import org.drip.measure.process.DiffusionEvolver; +import org.drip.measure.process.JumpDiffusionEvolver; +import org.drip.product.rates.FixFloatComponent; +import org.drip.quant.common.FormatUtil; +import org.drip.quant.linearalgebra.Matrix; +import org.drip.service.env.EnvManager; +import org.drip.state.identifier.CSALabel; +import org.drip.state.identifier.EntityFundingLabel; +import org.drip.state.identifier.EntityHazardLabel; +import org.drip.state.identifier.EntityRecoveryLabel; +import org.drip.state.identifier.ForwardLabel; +import org.drip.state.identifier.LatentStateLabel; +import org.drip.state.identifier.OvernightLabel; + +/* + * -*- 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. + */ + +/** + * PathTradeFlowAdjustment generates the Trade Flow Adjusted Variation Margin from Sparse Nodes for a + * Fix-Float Swap. The References are: + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Re-thinking Margin Period of Risk, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2902737, eSSRN. + * + * - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin, + * https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN. + * + * - 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. + * + * - Pykhtin, M. (2009): Modeling Counter-party Credit Exposure in the Presence of Margin Agreements, + * http://www.risk-europe.com/protected/michael-pykhtin.pdf. + * + * @author Lakshmi Krishnamurthy + */ + +public class PathTradeFlowAdjustment +{ + + private static final FixFloatComponent OTCIRS ( + final JulianDate spotDate, + final String currency, + final String maturityTenor, + final double coupon) + { + FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( + currency, + "ALL", + maturityTenor, + "MAIN" + ); + + return ffConv.createFixFloatComponent ( + spotDate, + maturityTenor, + coupon, + 0., + 1. + ); + } + + private static final PrimarySecurity OvernightReplicator ( + final String currency, + final List latentStateLabelList) + throws Exception + { + double overnightReplicatorDrift = 0.0025; + double overnightReplicatorVolatility = 0.001; + double overnightReplicatorRepo = 0.0; + + LatentStateLabel overnightLabel = OvernightLabel.Create (currency); + + latentStateLabelList.add (overnightLabel); + + return new PrimarySecurity ( + currency + "_OVERNIGHT", + overnightLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + overnightReplicatorDrift, + overnightReplicatorVolatility + ) + ), + overnightReplicatorRepo + ); + } + + private static final PrimarySecurity CSAReplicator ( + final String currency, + final List latentStateLabelList) + throws Exception + { + double csaReplicatorDrift = 0.01; + double csaReplicatorVolatility = 0.002; + double csaReplicatorRepo = 0.005; + + LatentStateLabel csaLabel = CSALabel.ISDA (currency); + + latentStateLabelList.add (csaLabel); + + return new PrimarySecurity ( + currency + "_CSA", + csaLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + csaReplicatorDrift, + csaReplicatorVolatility + ) + ), + csaReplicatorRepo + ); + } + + private static final PrimarySecurity DealerSeniorFundingReplicator ( + final String currency, + final String dealer, + final List latentStateLabelList) + throws Exception + { + double dealerSeniorFundingReplicatorDrift = 0.03; + double dealerSeniorFundingReplicatorVolatility = 0.002; + double dealerSeniorFundingReplicatorRepo = 0.028; + + LatentStateLabel dealerSeniorFundingLabel = EntityFundingLabel.Senior ( + dealer, + currency + ); + + latentStateLabelList.add (dealerSeniorFundingLabel); + + return new PrimarySecurity ( + dealer + "_" + currency + "_SENIOR_ZERO", + dealerSeniorFundingLabel, + new JumpDiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + dealerSeniorFundingReplicatorDrift, + dealerSeniorFundingReplicatorVolatility + ), + HazardJumpEvaluator.Standard ( + 0.3, + 0.45 + ) + ), + dealerSeniorFundingReplicatorRepo + ); + } + + private static final PrimarySecurity DealerSubordinateFundingReplicator ( + final String currency, + final String dealer, + final List latentStateLabelList) + throws Exception + { + double dealerSubordinateFundingReplicatorDrift = 0.045; + double dealerSubordinateFundingReplicatorVolatility = 0.002; + double dealerSubordinateFundingReplicatorRepo = 0.028; + + LatentStateLabel dealerSubordinateFundingLabel = EntityFundingLabel.Subordinate ( + dealer, + currency + ); + + latentStateLabelList.add (dealerSubordinateFundingLabel); + + return new PrimarySecurity ( + dealer + "_" + currency + "_SUBORDINATE_ZERO", + dealerSubordinateFundingLabel, + new JumpDiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + dealerSubordinateFundingReplicatorDrift, + dealerSubordinateFundingReplicatorVolatility + ), + HazardJumpEvaluator.Standard ( + 0.3, + 0.25 + ) + ), + dealerSubordinateFundingReplicatorRepo + ); + } + + private static final PrimarySecurity ClientFundingReplicator ( + final String currency, + final String client, + final List latentStateLabelList) + throws Exception + { + double clientFundingReplicatorDrift = 0.03; + double clientFundingReplicatorVolatility = 0.003; + double clientFundingReplicatorRepo = 0.028; + + LatentStateLabel clientFundingLabel = EntityFundingLabel.Senior ( + client, + currency + ); + + latentStateLabelList.add (clientFundingLabel); + + return new PrimarySecurity ( + client + "_" + currency + "_SENIOR_ZERO", + clientFundingLabel, + new JumpDiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + clientFundingReplicatorDrift, + clientFundingReplicatorVolatility + ), + HazardJumpEvaluator.Standard ( + 0.5, + 0.30 + ) + ), + clientFundingReplicatorRepo + ); + } + + private static final TerminalLatentState DealerHazard ( + final String currency, + final String dealer, + final List latentStateLabelList) + throws Exception + { + double dealerHazardDrift = 0.0002; + double dealerHazardVolatility = 0.02; + + LatentStateLabel dealerHazardLabel = EntityHazardLabel.Standard ( + dealer, + currency + ); + + latentStateLabelList.add (dealerHazardLabel); + + return new TerminalLatentState ( + dealerHazardLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + dealerHazardDrift, + dealerHazardVolatility + ) + ) + ); + } + + private static final TerminalLatentState DealerRecovery ( + final String currency, + final String dealer, + final List latentStateLabelList) + throws Exception + { + double dealerRecoveryDrift = 0.0002; + double dealerRecoveryVolatility = 0.02; + + LatentStateLabel dealerRecoveryLabel = EntityRecoveryLabel.Senior ( + dealer, + currency + ); + + latentStateLabelList.add (dealerRecoveryLabel); + + return new TerminalLatentState ( + dealerRecoveryLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + dealerRecoveryDrift, + dealerRecoveryVolatility + ) + ) + ); + } + + private static final TerminalLatentState ClientHazard ( + final String currency, + final String client, + final List latentStateLabelList) + throws Exception + { + double clientHazardDrift = 0.0002; + double clientHazardVolatility = 0.02; + + LatentStateLabel clientHazardLabel = EntityHazardLabel.Standard ( + client, + currency + ); + + latentStateLabelList.add (clientHazardLabel); + + return new TerminalLatentState ( + clientHazardLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + clientHazardDrift, + clientHazardVolatility + ) + ) + ); + } + + private static final TerminalLatentState ClientRecovery ( + final String currency, + final String client, + final List latentStateLabelList) + throws Exception + { + double clientRecoveryDrift = 0.0002; + double clientRecoveryVolatility = 0.02; + + LatentStateLabel clientRecoveryLabel = EntityRecoveryLabel.Senior ( + client, + currency + ); + + latentStateLabelList.add (clientRecoveryLabel); + + return new TerminalLatentState ( + clientRecoveryLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLogarithmic.Standard ( + clientRecoveryDrift, + clientRecoveryVolatility + ) + ) + ); + } + + private static final EntityDynamicsContainer EntityEvolver ( + final String currency, + final String dealer, + final String client, + final List latentStateLabelList) + throws Exception + { + return new EntityDynamicsContainer ( + DealerHazard ( + currency, + dealer, + latentStateLabelList + ), + DealerRecovery ( + currency, + dealer, + latentStateLabelList + ), + null, + ClientHazard ( + currency, + client, + latentStateLabelList + ), + ClientRecovery ( + currency, + client, + latentStateLabelList + ) + ); + } + + private static final PrimarySecurityDynamicsContainer PrimarySecurityEvolver ( + final String currency, + final String dealer, + final String client, + final List latentStateLabelList) + throws Exception + { + return new PrimarySecurityDynamicsContainer ( + null, + OvernightReplicator ( + currency, + latentStateLabelList + ), + CSAReplicator ( + currency, + latentStateLabelList + ), + DealerSeniorFundingReplicator ( + currency, + dealer, + latentStateLabelList + ), + DealerSubordinateFundingReplicator ( + currency, + dealer, + latentStateLabelList + ), + ClientFundingReplicator ( + currency, + client, + latentStateLabelList + ) + ); + } + + private static final LatentStateDynamicsContainer LatentStateEvolver ( + final ForwardLabel forwardLabel, + final List latentStateLabelList) + throws Exception + { + double otcFixFloatNumeraireDrift = 0.0; + double otcFixFloatNumeraireVolatility = 0.10; + + latentStateLabelList.add (forwardLabel); + + LatentStateDynamicsContainer latentStateDynamicsContainer = new LatentStateDynamicsContainer(); + + latentStateDynamicsContainer.addForward ( + new TerminalLatentState ( + forwardLabel, + new DiffusionEvolver ( + DiffusionEvaluatorLinear.Standard ( + otcFixFloatNumeraireDrift, + otcFixFloatNumeraireVolatility + ) + ) + ) + ); + + return latentStateDynamicsContainer; + } + + private static final MarketVertexGenerator ConstructMarketVertexGenerator ( + final JulianDate spotDate, + final String exposureSamplingTenor, + final int exposureSamplingNodeCount, + final String currency, + final String dealer, + final String client, + final ForwardLabel forwardLabel, + final List latentStateLabelList) + throws Exception + { + JulianDate terminationDate = spotDate; + int[] eventVertexArray = new int[exposureSamplingNodeCount]; + + for (int i = 0; i < exposureSamplingNodeCount; ++i) + { + terminationDate = terminationDate.addTenor (exposureSamplingTenor); + + eventVertexArray[i] = terminationDate.julian(); + } + + return new MarketVertexGenerator ( + spotDate.julian(), + eventVertexArray, + EntityEvolver ( + currency, + dealer, + client, + latentStateLabelList + ), + PrimarySecurityEvolver ( + currency, + dealer, + client, + latentStateLabelList + ), + LatentStateEvolver ( + forwardLabel, + latentStateLabelList + ) + ); + } + + public static final void main ( + final String[] args) + throws Exception + { + EnvManager.InitEnv (""); + + JulianDate spotDate = DateUtil.CreateFromYMD ( + 2018, + DateUtil.APRIL, + 19 + ); + + String latentStateGenerationTenor = "1D"; + int latentStateGenerationCount = 490; + int latentStateVertexCount = latentStateGenerationCount + 10; + String currency = "USD"; + String dealer = "NOM"; + String client = "SSGA"; + double[][] correlationMatrix = new double[][] + { + {1.00, 0.00, 0.20, 0.15, 0.05, 0.00, 0.00, 0.00, 0.00, 0.00}, // #0 DEALER HAZARD + {0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // #1 DEALER SENIOR RECOVERY + {0.20, 0.00, 1.00, 0.13, 0.25, 0.00, 0.00, 0.00, 0.00, 0.00}, // #2 CLIENT HAZARD + {0.15, 0.00, 0.13, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // #3 CLIENT RECOVERY + {0.05, 0.00, 0.25, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00}, // #4 OVERNIGHT REPLICATOR + {0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00}, // #5 CSA REPLICATOR + {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00}, // #6 DEALER SENIOR FUNDING REPLICATOR + {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00}, // #7 DEALER SUBORDINATE FUNDING REPLICATOR + {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, // #8 CLIENT FUNDING REPLICATOR + {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00}, // #9 FORWARD NUMERAIRE + }; + String sparseFixFloatExposureTenor = "3M"; + int sparseFixFloatExposureCount = 4; + String fixFloatMaturityTenor = "1Y"; + double fixFloatCoupon = 0.02; + double fixFloatNotional = -1.e+06; + + ForwardLabel forwardLabel = ForwardLabel.Create ( + currency, + "3M" + ); + + List latentStateLabelList = new ArrayList(); + + MarketVertexGenerator marketVertexGenerator = ConstructMarketVertexGenerator ( + spotDate, + latentStateGenerationTenor, + latentStateVertexCount, + currency, + dealer, + client, + forwardLabel, + latentStateLabelList + ); + + LatentStateVertexContainer latentStateVertexContainer = new LatentStateVertexContainer(); + + latentStateVertexContainer.add ( + ForwardLabel.Create ( + currency, + "3M" + ), + 0.02 + ); + + MarketVertex initialMarketVertex = MarketVertex.Epochal ( + spotDate, + 1.000, // dblOvernightNumeraireInitial + 1.000, // dblCSANumeraire + 0.015, // dblBankHazardRate + 0.400, // dblBankRecoveryRate + 0.015 / (1 - 0.40), // dblBankFundingSpread + 0.030, // dblCounterPartyHazardRate + 0.300, // dblCounterPartyRecoveryRate + 0.030 / (1 - 0.30), // dblCounterPartyFundingSpread + latentStateVertexContainer + ); + + FixFloatComponent fixFloatComponent = OTCIRS ( + spotDate, + currency, + fixFloatMaturityTenor, + fixFloatCoupon + ); + + FixFloatMPoR fixFloatMPoR = new FixFloatMPoR ( + fixFloatComponent, + fixFloatNotional + ); + + CorrelatedPathVertexDimension correlatedPathVertexDimension = new CorrelatedPathVertexDimension ( + new RandomNumberGenerator(), + correlationMatrix, + latentStateVertexCount, + 1, + true, + null + ); + + JulianDate sparseFixFloatExposureDate = spotDate; + int[] sparseFixFloatExposureDateArray = new int[sparseFixFloatExposureCount + 1]; + + for (int i = 0; i <= sparseFixFloatExposureCount; ++i) + { + sparseFixFloatExposureDateArray[i] = sparseFixFloatExposureDate.julian(); + + sparseFixFloatExposureDate = sparseFixFloatExposureDate.addTenor (sparseFixFloatExposureTenor); + } + + MarketPath marketPath = new MarketPath ( + marketVertexGenerator.marketVertex ( + initialMarketVertex, + LatentStateWeiner.FromUnitRandom ( + latentStateLabelList, + Matrix.Transpose (correlatedPathVertexDimension.straightPathVertexRd().flatform()) + ) + ) + ); + + PathCoordinator pathCoordinator = new PathCoordinator ( + fixFloatMPoR, + marketPath + ); + + AndersenPykhtinSokolPath andersenPykhtinSokolPath = pathCoordinator.andersenPykhtinSokolPath + (sparseFixFloatExposureDateArray); + + TradePayment[] tradePaymentArray = andersenPykhtinSokolPath.denseTradePaymentArray(); + + JulianDate denseExposureDate = spotDate; + + for (TradePayment tradePayment : tradePaymentArray) + { + System.out.println ("\t|| " + + denseExposureDate + " => " + + FormatUtil.FormatDouble (tradePayment.dealer(), 5, 0, 1.) + " | " + + FormatUtil.FormatDouble (tradePayment.client(), 5, 0, 1.) + " ||" + ); + + denseExposureDate = denseExposureDate.addDays (1); + } + + Map variationMarginEstimateVertexTrajectory = + andersenPykhtinSokolPath.variationMarginEstimateTrajectory(); + + System.out.println ("\t||--------------------------------||"); + + System.out.println ("\t|| Unadjusted/Adjusted VM ||"); + + System.out.println ("\t||--------------------------------||"); + + System.out.println ("\t|| ||"); + + System.out.println ("\t|| L -> R: ||"); + + System.out.println ("\t|| - Exposure Date ||"); + + System.out.println ("\t|| - Unadjusted VM ||"); + + System.out.println ("\t|| - Adjusted VM ||"); + + System.out.println ("\t||--------------------------------||"); + + for (Map.Entry variationMarginEstimateVertexEntry : + variationMarginEstimateVertexTrajectory.entrySet()) + { + VariationMarginEstimateVertex variationMarginEstimateVertex = + variationMarginEstimateVertexEntry.getValue(); + + System.out.println ("\t|| " + + new JulianDate (variationMarginEstimateVertexEntry.getKey()) + " => " + + FormatUtil.FormatDouble (variationMarginEstimateVertex.unadjusted(), 5, 0, 1.) + " | " + + FormatUtil.FormatDouble (variationMarginEstimateVertex.adjusted(), 5, 0, 1.) + " ||" + ); + } + + System.out.println ("\t||--------------------------------||"); + + EnvManager.TerminateEnv(); + } +} diff --git a/src/main/java/org/drip/sample/andersen2017vm/package-info.java b/src/main/java/org/drip/sample/andersen2017vm/package-info.java new file mode 100644 index 000000000000..c575f9a09346 --- /dev/null +++ b/src/main/java/org/drip/sample/andersen2017vm/package-info.java @@ -0,0 +1,8 @@ + +/** + * Andersen Pykhtin Sokol Regression VM + * + * @author Lakshmi Krishnamurthy + */ + +package org.drip.sample.andersen2017vm; diff --git a/src/main/java/org/drip/service/env/BuildManager.java b/src/main/java/org/drip/service/env/BuildManager.java index 88ea4d5fa1fd..652faf4744c9 100644 --- a/src/main/java/org/drip/service/env/BuildManager.java +++ b/src/main/java/org/drip/service/env/BuildManager.java @@ -69,6 +69,11 @@ public static final boolean Init() try { s_aBuildRecord = new org.drip.service.env.BuildRecord[] { + new org.drip.service.env.BuildRecord ( + "3.54.0", + "1.8.0_112", + "Fri Jun 15 22:02:20 EST 2018" + ), new org.drip.service.env.BuildRecord ( "3.52.0", "1.8.0_112",